diff mbox

[RFC] Add check_effective_target_vect_min_max

Message ID 55CAE8FA.1020504@mentor.com
State New
Headers show

Commit Message

Tom de Vries Aug. 12, 2015, 6:34 a.m. UTC
[ was: Re: [committed, testsuite] Fix vect/trapv-vect-reduc-4.c for sparc  ]

On 12/08/15 07:57, Tom de Vries wrote:
> Hi,
>
> For sparc, the scan for 'vectorized 2 loops' in
> vect/trapv-vect-reduc-4.c fail because the vector instructions min and
> max are not supported.
>
> Tested on x86_64. Tested on sparc by Rainer.
>

This follow-up patch introduces a new effective target vect_min_max, 
similar to how effective target vect_bswap is implemented.

Any comments?

Thanks,
- Tom

Comments

Rainer Orth Aug. 12, 2015, 8:51 a.m. UTC | #1
Tom de Vries <Tom_deVries@mentor.com> writes:

> This follow-up patch introduces a new effective target vect_min_max,
> similar to how effective target vect_bswap is implemented.
>
> Any comments?
>
> Thanks,
> - Tom
>
> Add check_effective_target_vect_min_max
>
> 2015-08-12  Tom de Vries  <tom@codesourcery.com>
>
> 	* lib/target-supports.exp (check_effective_target_vect_min_max): New
> 	proc.
> 	* gcc.dg/vect/trapv-vect-reduc-4.c: Use vect_min_max effective target.

Looks good to me, but the new effective-target keyword needs documenting
in sourcebuild.texi.

	Rainer
Tom de Vries Aug. 12, 2015, 9:14 a.m. UTC | #2
On 12/08/15 10:51, Rainer Orth wrote:
> Tom de Vries <Tom_deVries@mentor.com> writes:
>
>> This follow-up patch introduces a new effective target vect_min_max,
>> similar to how effective target vect_bswap is implemented.
>>
>> Any comments?
>>
>> Thanks,
>> - Tom
>>
>> Add check_effective_target_vect_min_max
>>
>> 2015-08-12  Tom de Vries  <tom@codesourcery.com>
>>
>> 	* lib/target-supports.exp (check_effective_target_vect_min_max): New
>> 	proc.
>> 	* gcc.dg/vect/trapv-vect-reduc-4.c: Use vect_min_max effective target.
>
> Looks good to me, but the new effective-target keyword needs documenting
> in sourcebuild.texi.
>

Hmm, in sourcebuild.texi I found:
...
@item vect_no_int_max
Target does not support a vector max instruction on @code{int}.
...

That looks related. [ I also found a patch introducing vect_no_uint_max 
here: https://gcc.gnu.org/ml/gcc-patches/2010-01/msg00152.html. ]

I'm not sure where to take it from here. Should I introduce 
vect_no_int_min, and use that in combination with vect_no_int_max?

Thanks,
- Tom
Rainer Orth Aug. 12, 2015, 9:18 a.m. UTC | #3
Tom de Vries <Tom_deVries@mentor.com> writes:

> On 12/08/15 10:51, Rainer Orth wrote:
>> Tom de Vries <Tom_deVries@mentor.com> writes:
>>
>>> This follow-up patch introduces a new effective target vect_min_max,
>>> similar to how effective target vect_bswap is implemented.
>>>
>>> Any comments?
>>>
>>> Thanks,
>>> - Tom
>>>
>>> Add check_effective_target_vect_min_max
>>>
>>> 2015-08-12  Tom de Vries  <tom@codesourcery.com>
>>>
>>> 	* lib/target-supports.exp (check_effective_target_vect_min_max): New
>>> 	proc.
>>> 	* gcc.dg/vect/trapv-vect-reduc-4.c: Use vect_min_max effective target.
>>
>> Looks good to me, but the new effective-target keyword needs documenting
>> in sourcebuild.texi.
>>
>
> Hmm, in sourcebuild.texi I found:
> ...
> @item vect_no_int_max
> Target does not support a vector max instruction on @code{int}.
> ...
>
> That looks related. [ I also found a patch introducing vect_no_uint_max
> here: https://gcc.gnu.org/ml/gcc-patches/2010-01/msg00152.html. ]
>
> I'm not sure where to take it from here. Should I introduce
> vect_no_int_min, and use that in combination with vect_no_int_max?

I'd say this is something for the vectorizer maintainers to decide.  Richi?

	Rainer
Richard Biener Aug. 12, 2015, 10:06 a.m. UTC | #4
On Wed, 12 Aug 2015, Rainer Orth wrote:

> Tom de Vries <Tom_deVries@mentor.com> writes:
> 
> > On 12/08/15 10:51, Rainer Orth wrote:
> >> Tom de Vries <Tom_deVries@mentor.com> writes:
> >>
> >>> This follow-up patch introduces a new effective target vect_min_max,
> >>> similar to how effective target vect_bswap is implemented.
> >>>
> >>> Any comments?
> >>>
> >>> Thanks,
> >>> - Tom
> >>>
> >>> Add check_effective_target_vect_min_max
> >>>
> >>> 2015-08-12  Tom de Vries  <tom@codesourcery.com>
> >>>
> >>> 	* lib/target-supports.exp (check_effective_target_vect_min_max): New
> >>> 	proc.
> >>> 	* gcc.dg/vect/trapv-vect-reduc-4.c: Use vect_min_max effective target.
> >>
> >> Looks good to me, but the new effective-target keyword needs documenting
> >> in sourcebuild.texi.
> >>
> >
> > Hmm, in sourcebuild.texi I found:
> > ...
> > @item vect_no_int_max
> > Target does not support a vector max instruction on @code{int}.
> > ...
> >
> > That looks related. [ I also found a patch introducing vect_no_uint_max
> > here: https://gcc.gnu.org/ml/gcc-patches/2010-01/msg00152.html. ]
> >
> > I'm not sure where to take it from here. Should I introduce
> > vect_no_int_min, and use that in combination with vect_no_int_max?
> 
> I'd say this is something for the vectorizer maintainers to decide.  Richi?

I expect the above is already effectively
vect_no_int_min as well (which target would support min but not max...?).

So after double-checking that you could rename it to vect_no_int_min_max.

Richard.
diff mbox

Patch

Add check_effective_target_vect_min_max

2015-08-12  Tom de Vries  <tom@codesourcery.com>

	* lib/target-supports.exp (check_effective_target_vect_min_max): New
	proc.
	* gcc.dg/vect/trapv-vect-reduc-4.c: Use vect_min_max effective target.
---
 gcc/testsuite/gcc.dg/vect/trapv-vect-reduc-4.c |  2 +-
 gcc/testsuite/lib/target-supports.exp          | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/vect/trapv-vect-reduc-4.c b/gcc/testsuite/gcc.dg/vect/trapv-vect-reduc-4.c
index 8fd353c..1624696 100644
--- a/gcc/testsuite/gcc.dg/vect/trapv-vect-reduc-4.c
+++ b/gcc/testsuite/gcc.dg/vect/trapv-vect-reduc-4.c
@@ -47,4 +47,4 @@  int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "Detected reduction\\." 2 "vect"  } } */
-/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { ! { sparc*-*-* } } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { vect_min_max } } } } */
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 1988301..c585e5f 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -3568,6 +3568,24 @@  proc check_effective_target_vect_bswap { } {
     return $et_vect_bswap_saved
 }
 
+# Return 1 if the target supports vector min/max operations.
+
+proc check_effective_target_vect_min_max { } {
+    global et_vect_min_max_saved
+
+    if [info exists et_vect_min_max_saved] {
+	verbose "check_effective_target_vect_min_max: using cached result" 2
+    } else {
+	set et_vect_min_max_saved 1
+	if { [istarget sparc*-*-*] } {
+	   set et_vect_min_max_saved 0
+	}
+    }
+
+    verbose "check_effective_target_vect_min_max: returning $et_vect_min_max_saved" 2
+    return $et_vect_min_max_saved
+}
+
 # Return 1 if the target supports hardware vector shift operation for char.
 
 proc check_effective_target_vect_shift_char { } {
-- 
1.9.1