diff mbox

Fix vectorizer testsuite failures, including PR 46312

Message ID OFD5B0D260.E1A31BEE-ONC22577DC.00407150-C22577DC.00421F9B@il.ibm.com
State New
Headers show

Commit Message

Ira Rosen Nov. 15, 2010, 12:02 p.m. UTC
Hi,

vect-scal-opt*.c check vector shift with scalar shift argument. So I added
vect_shift_scalar keyword for them. I only put x86_64-*-* there. What other
targets support such shifts?

pr43430-2.c uses dg-options to set compiler flags, overriding target
dependent vectorization flags in vect.exp, and rather than that the flags
are the same as the default flags in vect.exp (I don't think that -O3 is
needed). So I removed dg-options from the test.

The rest of the tests test reverse access which is supported only on
targets that support misaligned accesses. I added vect_hw_misalign to these
tests.

Tested on powerpc64-suse-linux and x86_64-suse-linux.

OK to apply (after possible update of
check_effective_target_vect_shift_scalar)?

Thanks,
Ira


testsuite/ChangeLog:

	PR tree-optimization/46312
	* gcc.dg/vect/vect-scal-opt2.c: Expect to pass only on targets
	that support vector shifts with scalar shift argument.
	* gcc.dg/vect/vect-scal-opt.c, gcc.dg/vect/vect-scal-opt1.c:
Likewise.
	* gcc.dg/vect/vect-114.c: Expect to pass only on targets that
	support misaligned data accesses.
	* gcc.dg/vect/pr43432.c, gcc.dg/vect/vect-15.c: Likewise.
	* gcc.dg/vect/pr43430-2.c: Remove dg-options.
	* lib/target-supports.exp (check_effective_target_vect_shift_scalar):
	New.

 #
 # This can change for different subtargets so do not cache the result.

Comments

H.J. Lu Nov. 15, 2010, 1:40 p.m. UTC | #1
On Mon, Nov 15, 2010 at 4:02 AM, Ira Rosen <IRAR@il.ibm.com> wrote:
>
> Hi,
>
> vect-scal-opt*.c check vector shift with scalar shift argument. So I added
> vect_shift_scalar keyword for them. I only put x86_64-*-* there. What other
> targets support such shifts?

i?86-*-* with SSE2 enabled?

> pr43430-2.c uses dg-options to set compiler flags, overriding target
> dependent vectorization flags in vect.exp, and rather than that the flags
> are the same as the default flags in vect.exp (I don't think that -O3 is
> needed). So I removed dg-options from the test.
>
> The rest of the tests test reverse access which is supported only on
> targets that support misaligned accesses. I added vect_hw_misalign to these
> tests.
>
> Tested on powerpc64-suse-linux and x86_64-suse-linux.
>
> OK to apply (after possible update of
> check_effective_target_vect_shift_scalar)?
>
> Thanks,
> Ira
>
>
> testsuite/ChangeLog:
>
>        PR tree-optimization/46312
>        * gcc.dg/vect/vect-scal-opt2.c: Expect to pass only on targets
>        that support vector shifts with scalar shift argument.
>        * gcc.dg/vect/vect-scal-opt.c, gcc.dg/vect/vect-scal-opt1.c:
> Likewise.
>        * gcc.dg/vect/vect-114.c: Expect to pass only on targets that
>        support misaligned data accesses.
>        * gcc.dg/vect/pr43432.c, gcc.dg/vect/vect-15.c: Likewise.
>        * gcc.dg/vect/pr43430-2.c: Remove dg-options.
>        * lib/target-supports.exp (check_effective_target_vect_shift_scalar):
>        New.
>
Ira Rosen Nov. 15, 2010, 1:47 p.m. UTC | #2
"H.J. Lu" <hjl.tools@gmail.com> wrote on 15/11/2010 03:40:44 PM:

> On Mon, Nov 15, 2010 at 4:02 AM, Ira Rosen <IRAR@il.ibm.com> wrote:
> >
> > Hi,
> >
> > vect-scal-opt*.c check vector shift with scalar shift argument. So I
added
> > vect_shift_scalar keyword for them. I only put x86_64-*-* there. What
other
> > targets support such shifts?
>
> i?86-*-* with SSE2 enabled?

vect.exp adds -msse2 for i?86-*-*. So, I'll add i?86-*-*.

Thanks,
Ira

>
> > pr43430-2.c uses dg-options to set compiler flags, overriding target
> > dependent vectorization flags in vect.exp, and rather than that the
flags
> > are the same as the default flags in vect.exp (I don't think that -O3
is
> > needed). So I removed dg-options from the test.
> >
> > The rest of the tests test reverse access which is supported only on
> > targets that support misaligned accesses. I added vect_hw_misalign to
these
> > tests.
> >
> > Tested on powerpc64-suse-linux and x86_64-suse-linux.
> >
> > OK to apply (after possible update of
> > check_effective_target_vect_shift_scalar)?
> >
> > Thanks,
> > Ira
> >
> >
> > testsuite/ChangeLog:
> >
> >        PR tree-optimization/46312
> >        * gcc.dg/vect/vect-scal-opt2.c: Expect to pass only on targets
> >        that support vector shifts with scalar shift argument.
> >        * gcc.dg/vect/vect-scal-opt.c, gcc.dg/vect/vect-scal-opt1.c:
> > Likewise.
> >        * gcc.dg/vect/vect-114.c: Expect to pass only on targets that
> >        support misaligned data accesses.
> >        * gcc.dg/vect/pr43432.c, gcc.dg/vect/vect-15.c: Likewise.
> >        * gcc.dg/vect/pr43430-2.c: Remove dg-options.
> >        * lib/target-supports.exp
(check_effective_target_vect_shift_scalar):
> >        New.
> >
>
>
> --
> H.J.
Ira Rosen Nov. 15, 2010, 1:51 p.m. UTC | #3
gcc-patches-owner@gcc.gnu.org wrote on 15/11/2010 03:47:46 PM:

> From: Ira Rosen/Haifa/IBM@IBMIL
> To: "H.J. Lu" <hjl.tools@gmail.com>
> Cc: gcc-patches@gcc.gnu.org
> Date: 15/11/2010 03:48 PM
> Subject: Re: [patch] Fix vectorizer testsuite failures, including PR
46312
> Sent by: gcc-patches-owner@gcc.gnu.org
>
>
>
> "H.J. Lu" <hjl.tools@gmail.com> wrote on 15/11/2010 03:40:44 PM:
>
> > On Mon, Nov 15, 2010 at 4:02 AM, Ira Rosen <IRAR@il.ibm.com> wrote:
> > >
> > > Hi,
> > >
> > > vect-scal-opt*.c check vector shift with scalar shift argument. So I
> added
> > > vect_shift_scalar keyword for them. I only put x86_64-*-* there. What
> other
> > > targets support such shifts?
> >
> > i?86-*-* with SSE2 enabled?
>
> vect.exp adds -msse2 for i?86-*-*. So, I'll add i?86-*-*.

But vect-scal-opt*.c use /* { dg-options "-O -fdump-tree-veclower" } */, so
we may need to remove it and run the tests with vect.exp options.

Ira


>
> Thanks,
> Ira
>
> >
> > > pr43430-2.c uses dg-options to set compiler flags, overriding target
> > > dependent vectorization flags in vect.exp, and rather than that the
> flags
> > > are the same as the default flags in vect.exp (I don't think that -O3
> is
> > > needed). So I removed dg-options from the test.
> > >
> > > The rest of the tests test reverse access which is supported only on
> > > targets that support misaligned accesses. I added vect_hw_misalign to
> these
> > > tests.
> > >
> > > Tested on powerpc64-suse-linux and x86_64-suse-linux.
> > >
> > > OK to apply (after possible update of
> > > check_effective_target_vect_shift_scalar)?
> > >
> > > Thanks,
> > > Ira
> > >
> > >
> > > testsuite/ChangeLog:
> > >
> > >        PR tree-optimization/46312
> > >        * gcc.dg/vect/vect-scal-opt2.c: Expect to pass only on targets
> > >        that support vector shifts with scalar shift argument.
> > >        * gcc.dg/vect/vect-scal-opt.c, gcc.dg/vect/vect-scal-opt1.c:
> > > Likewise.
> > >        * gcc.dg/vect/vect-114.c: Expect to pass only on targets that
> > >        support misaligned data accesses.
> > >        * gcc.dg/vect/pr43432.c, gcc.dg/vect/vect-15.c: Likewise.
> > >        * gcc.dg/vect/pr43430-2.c: Remove dg-options.
> > >        * lib/target-supports.exp
> (check_effective_target_vect_shift_scalar):
> > >        New.
> > >
> >
> >
> > --
> > H.J.
>
H.J. Lu Nov. 15, 2010, 3:39 p.m. UTC | #4
On Mon, Nov 15, 2010 at 5:51 AM, Ira Rosen <IRAR@il.ibm.com> wrote:
>
>
> gcc-patches-owner@gcc.gnu.org wrote on 15/11/2010 03:47:46 PM:
>
>> From: Ira Rosen/Haifa/IBM@IBMIL
>> To: "H.J. Lu" <hjl.tools@gmail.com>
>> Cc: gcc-patches@gcc.gnu.org
>> Date: 15/11/2010 03:48 PM
>> Subject: Re: [patch] Fix vectorizer testsuite failures, including PR
> 46312
>> Sent by: gcc-patches-owner@gcc.gnu.org
>>
>>
>>
>> "H.J. Lu" <hjl.tools@gmail.com> wrote on 15/11/2010 03:40:44 PM:
>>
>> > On Mon, Nov 15, 2010 at 4:02 AM, Ira Rosen <IRAR@il.ibm.com> wrote:
>> > >
>> > > Hi,
>> > >
>> > > vect-scal-opt*.c check vector shift with scalar shift argument. So I
>> added
>> > > vect_shift_scalar keyword for them. I only put x86_64-*-* there. What
>> other
>> > > targets support such shifts?
>> >
>> > i?86-*-* with SSE2 enabled?
>>
>> vect.exp adds -msse2 for i?86-*-*. So, I'll add i?86-*-*.
>
> But vect-scal-opt*.c use /* { dg-options "-O -fdump-tree-veclower" } */, so
> we may need to remove it and run the tests with vect.exp options.

Won't it also enable vectorizer? Maybe we should add -msse2 for
i?86-*-* targets.

H.J.
----
> Ira
>
>
>>
>> Thanks,
>> Ira
>>
>> >
>> > > pr43430-2.c uses dg-options to set compiler flags, overriding target
>> > > dependent vectorization flags in vect.exp, and rather than that the
>> flags
>> > > are the same as the default flags in vect.exp (I don't think that -O3
>> is
>> > > needed). So I removed dg-options from the test.
>> > >
>> > > The rest of the tests test reverse access which is supported only on
>> > > targets that support misaligned accesses. I added vect_hw_misalign to
>> these
>> > > tests.
>> > >
>> > > Tested on powerpc64-suse-linux and x86_64-suse-linux.
>> > >
>> > > OK to apply (after possible update of
>> > > check_effective_target_vect_shift_scalar)?
>> > >
>> > > Thanks,
>> > > Ira
>> > >
>> > >
>> > > testsuite/ChangeLog:
>> > >
>> > >        PR tree-optimization/46312
>> > >        * gcc.dg/vect/vect-scal-opt2.c: Expect to pass only on targets
>> > >        that support vector shifts with scalar shift argument.
>> > >        * gcc.dg/vect/vect-scal-opt.c, gcc.dg/vect/vect-scal-opt1.c:
>> > > Likewise.
>> > >        * gcc.dg/vect/vect-114.c: Expect to pass only on targets that
>> > >        support misaligned data accesses.
>> > >        * gcc.dg/vect/pr43432.c, gcc.dg/vect/vect-15.c: Likewise.
>> > >        * gcc.dg/vect/pr43430-2.c: Remove dg-options.
>> > >        * lib/target-supports.exp
>> (check_effective_target_vect_shift_scalar):
>> > >        New.
>> > >
>> >
>> >
>> > --
>> > H.J.
>>
>
>
Tejas Belagod Nov. 16, 2010, 11:01 a.m. UTC | #5
On Mon, 2010-11-15 at 14:02 +0200, Ira Rosen wrote:
> Hi,
> 
> vect-scal-opt*.c check vector shift with scalar shift argument. So I added
> vect_shift_scalar keyword for them. I only put x86_64-*-* there. What other
> targets support such shifts?

Ira,

ARM-NEON supports vector shift left and right with a scalar immediate.

VSH{R/L}.{S/U}{8/16/32/64} {Q/D}, {Q/D}, #imm

Thanks,
Tejas.
Ira Rosen Nov. 16, 2010, 12:23 p.m. UTC | #6
Tejas Belagod <tejas.belagod@arm.com> wrote on 16/11/2010 01:01:35 PM:

> On Mon, 2010-11-15 at 14:02 +0200, Ira Rosen wrote:
> > Hi,
> >
> > vect-scal-opt*.c check vector shift with scalar shift argument. So I
added
> > vect_shift_scalar keyword for them. I only put x86_64-*-* there. What
other
> > targets support such shifts?
>
> Ira,
>
> ARM-NEON supports vector shift left and right with a scalar immediate.
>
> VSH{R/L}.{S/U}{8/16/32/64} {Q/D}, {Q/D}, #imm

But it doesn't work here, I see shift with vector arg:

v2_13 = {k.1_12, k.1_12, k.1_12, k.1_12, k.1_12, k.1_12, k.1_12, k.1_12};
r1.2_14 = v0_4 >> v2_13;

I used -O -fdump-tree-veclower  -mfpu=neon -ffast-math -mfloat-abi=softfp.

Thanks,
Ira

>
> Thanks,
> Tejas.
>
>
>
>
Ramana Radhakrishnan Nov. 16, 2010, 12:33 p.m. UTC | #7
On Tue, Nov 16, 2010 at 12:23 PM, Ira Rosen <IRAR@il.ibm.com> wrote:
>
>
> Tejas Belagod <tejas.belagod@arm.com> wrote on 16/11/2010 01:01:35 PM:
>
>> On Mon, 2010-11-15 at 14:02 +0200, Ira Rosen wrote:
>> > Hi,
>> >
>> > vect-scal-opt*.c check vector shift with scalar shift argument. So I
> added
>> > vect_shift_scalar keyword for them. I only put x86_64-*-* there. What
> other
>> > targets support such shifts?
>>
>> Ira,
>>
>> ARM-NEON supports vector shift left and right with a scalar immediate.
>>
>> VSH{R/L}.{S/U}{8/16/32/64} {Q/D}, {Q/D}, #imm
>
> But it doesn't work here, I see shift with vector arg:
>
> v2_13 = {k.1_12, k.1_12, k.1_12, k.1_12, k.1_12, k.1_12, k.1_12, k.1_12};
> r1.2_14 = v0_4 >> v2_13;
>
> I used -O -fdump-tree-veclower  -mfpu=neon -ffast-math -mfloat-abi=softfp.
>

Might just be that we don't support this yet, though I do remember a
patch from earlier this year. I can't remember how this changed over
time.

http://gcc.gnu.org/ml/gcc-patches/2010-02/msg00462.html


Ramana




> Thanks,
> Ira
>
>>
>> Thanks,
>> Tejas.
>>
>>
>>
>>
>
>
Ira Rosen Nov. 16, 2010, 1:33 p.m. UTC | #8
Ramana Radhakrishnan <ramana.gcc@googlemail.com> wrote on 16/11/2010
02:33:57 PM:

> On Tue, Nov 16, 2010 at 12:23 PM, Ira Rosen <IRAR@il.ibm.com> wrote:
> >
> >
> > Tejas Belagod <tejas.belagod@arm.com> wrote on 16/11/2010 01:01:35 PM:
> >
> >> On Mon, 2010-11-15 at 14:02 +0200, Ira Rosen wrote:
> >> > Hi,
> >> >
> >> > vect-scal-opt*.c check vector shift with scalar shift argument. So I
> > added
> >> > vect_shift_scalar keyword for them. I only put x86_64-*-* there.
What
> > other
> >> > targets support such shifts?
> >>
> >> Ira,
> >>
> >> ARM-NEON supports vector shift left and right with a scalar immediate.
> >>
> >> VSH{R/L}.{S/U}{8/16/32/64} {Q/D}, {Q/D}, #imm
> >
> > But it doesn't work here, I see shift with vector arg:
> >
> > v2_13 = {k.1_12, k.1_12, k.1_12, k.1_12, k.1_12, k.1_12, k.1_12,
k.1_12};
> > r1.2_14 = v0_4 >> v2_13;
> >
> > I used -O -fdump-tree-veclower  -mfpu=neon -ffast-math
-mfloat-abi=softfp.
> >
>
> Might just be that we don't support this yet, though I do remember a
> patch from earlier this year. I can't remember how this changed over
> time.
>
> http://gcc.gnu.org/ml/gcc-patches/2010-02/msg00462.html

I found this ping http://gcc.gnu.org/ml/gcc-patches/2010-10/msg01545.html.
I don't think the patch was committed.

Ira

>
>
> Ramana
>
>
>
>
> > Thanks,
> > Ira
> >
> >>
> >> Thanks,
> >> Tejas.
> >>
> >>
> >>
> >>
> >
> >
diff mbox

Patch

Index: testsuite/gcc.dg/vect/vect-scal-opt2.c
===================================================================
--- testsuite/gcc.dg/vect/vect-scal-opt2.c      (revision 166749)
+++ testsuite/gcc.dg/vect/vect-scal-opt2.c      (working copy)
@@ -17,5 +17,5 @@  int main (int argc, char *argv[]) {
    return vidx(short, r1, 0);
 }

-/* { dg-final { scan-tree-dump-times ">> 2" 1 "veclower" } } */
+/* { dg-final { scan-tree-dump-times ">> 2" 1 "veclower" { target
vect_shift_scalar } } } */
 /* { dg-final { cleanup-tree-dump "veclower" } } */
Index: testsuite/gcc.dg/vect/vect-114.c
===================================================================
--- testsuite/gcc.dg/vect/vect-114.c    (revision 166749)
+++ testsuite/gcc.dg/vect/vect-114.c    (working copy)
@@ -34,7 +34,7 @@  int main (void)
   return main1 ();
 }

-/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1
"vect" { target { ! vect_perm } } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1
"vect" { target vect_perm } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1
"vect" { target { ! { vect_perm && vect_hw_misalign } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1
"vect" { target { vect_perm && vect_hw_misalign } } } } */
 /* { dg-final { cleanup-tree-dump "vect" } } */

Index: testsuite/gcc.dg/vect/pr43432.c
===================================================================
--- testsuite/gcc.dg/vect/pr43432.c     (revision 166749)
+++ testsuite/gcc.dg/vect/pr43432.c     (working copy)
@@ -10,5 +10,5 @@  int len){
         dst[i] = src0[i] * src1[-i];
 }

-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1
"vect" { target { vect_perm } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1
"vect" { target { vect_perm && vect_hw_misalign } } } } */
 /* { dg-final { cleanup-tree-dump "vect" } } */
Index: testsuite/gcc.dg/vect/pr43430-2.c
===================================================================
--- testsuite/gcc.dg/vect/pr43430-2.c   (revision 166749)
+++ testsuite/gcc.dg/vect/pr43430-2.c   (working copy)
@@ -1,6 +1,5 @@ 
 /* { dg-do compile } */
 /* { dg-require-effective-target vect_int } */
-/* { dg-options "-O3 -fno-vect-cost-model -fdump-tree-vect-details" } */
 typedef unsigned char uint8_t;
 vsad16_c (void *c, uint8_t * s1, uint8_t * s2, int stride, int h)
 {
Index: testsuite/gcc.dg/vect/vect-scal-opt.c
===================================================================
--- testsuite/gcc.dg/vect/vect-scal-opt.c       (revision 166749)
+++ testsuite/gcc.dg/vect/vect-scal-opt.c       (working copy)
@@ -20,5 +20,5 @@  int main (int argc, char *argv[]) {
    return vidx(short, r1, 0);
 }

-/* { dg-final { scan-tree-dump-times ">> k.\[0-9_\]*" 1 "veclower" } } */
+/* { dg-final { scan-tree-dump-times ">> k.\[0-9_\]*" 1
"veclower" { target vect_shift_scalar } } } */
 /* { dg-final { cleanup-tree-dump "veclower" } } */
Index: testsuite/gcc.dg/vect/vect-scal-opt1.c
===================================================================
--- testsuite/gcc.dg/vect/vect-scal-opt1.c      (revision 166749)
+++ testsuite/gcc.dg/vect/vect-scal-opt1.c      (working copy)
@@ -18,5 +18,5 @@  int main (int argc, char *argv[]) {
    return vidx(short, r1, 0);
 }

-/* { dg-final { scan-tree-dump-times ">> 2" 1 "veclower" } } */
+/* { dg-final { scan-tree-dump-times ">> 2" 1 "veclower" { target
vect_shift_scalar } } } */
 /* { dg-final { cleanup-tree-dump "veclower" } } */
Index: testsuite/gcc.dg/vect/vect-15.c
===================================================================
--- testsuite/gcc.dg/vect/vect-15.c     (revision 166749)
+++ testsuite/gcc.dg/vect/vect-15.c     (working copy)
@@ -35,5 +35,5 @@  int main (void)
   return main1 ();
 }

-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1
"vect" { target vect_perm } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1
"vect" { target { vect_perm && vect_hw_misalign } } } } */
 /* { dg-final { cleanup-tree-dump "vect" } } */
Index: testsuite/lib/target-supports.exp
===================================================================
--- testsuite/lib/target-supports.exp   (revision 166743)
+++ testsuite/lib/target-supports.exp   (working copy)
@@ -2258,6 +2258,26 @@  proc check_effective_target_vect_shift { } {
     return $et_vect_shift_saved
 }

+# Return 1 if the target supports hardware vector shift operation with
+# scalar shift argument.
+
+proc check_effective_target_vect_shift_scalar { } {
+    global et_vect_shift_scalar_saved
+
+    if [info exists et_vect_shift_scalar_saved] {
+        verbose "check_effective_target_vect_shift_scalar: using cached
result" 2
+    } else {
+        set et_vect_shift_scalar_saved 0
+        if { [istarget x86_64-*-*] } {
+           set et_vect_shift_scalar_saved 1
+        }
+    }
+
+    verbose "check_effective_target_vect_shift_scalar: returning
$et_vect_shift_scalar_saved" 2
+    return $et_vect_shift_scalar_saved
+}
+
+
 # Return 1 if the target supports hardware vectors of long, 0 otherwise.