[PATCH 4/5] New target check for double<->int conversions
Andreas Krebbel
krebbel@linux.vnet.ibm.com
Thu Sep 28 11:53:00 GMT 2017
gcc/ChangeLog:
2017-09-28 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* doc/sourcebuild.texi: Document vect_intdouble_cvt and
vect_doubleint_cvt.
gcc/testsuite/ChangeLog:
2017-09-28 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* gcc.dg/vect/pr66251.c: Replace vect_floatint_cvt with
vect_doubleint_cvt and vect_intfloat_cvt with vect_intdouble_cvt.
* gcc.dg/vect/vect-floatint-conversion-2.c: Replace
vect_floatint_cvt with vect_doubleint_cvt.
* gcc.dg/vect/vect-intfloat-conversion-3.c: Replace
vect_intfloat_cvt with vect_intdouble_cvt.
* gfortran.dg/vect/pr60510.f: Require vect_intdouble_cvt.
* gfortran.dg/vect/vect-8.f90: Make number of vectorized loops
depend on vect_intdouble_cvt.
* lib/target-supports.exp
(check_effective_target_vect_doubleint_cvt)
(check_effective_target_vect_intdouble_cvt): New procs.
---
gcc/doc/sourcebuild.texi | 6 +++
gcc/testsuite/gcc.dg/vect/pr66251.c | 4 +-
.../gcc.dg/vect/vect-floatint-conversion-2.c | 2 +-
.../gcc.dg/vect/vect-intfloat-conversion-3.c | 2 +-
gcc/testsuite/gfortran.dg/vect/pr60510.f | 1 +
gcc/testsuite/gfortran.dg/vect/vect-8.f90 | 3 +-
gcc/testsuite/lib/target-supports.exp | 62 ++++++++++++++++++++++
7 files changed, 75 insertions(+), 5 deletions(-)
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 4f25268..e09bca1 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -1508,6 +1508,12 @@ Target supports conversion from @code{float} to @code{signed int}.
@item vect_floatuint_cvt
Target supports conversion from @code{float} to @code{unsigned int}.
+@item vect_intdouble_cvt
+Target supports conversion from @code{signed int} to @code{double}.
+
+@item vect_doubleint_cvt
+Target supports conversion from @code{double} to @code{signed int}.
+
@item vect_max_reduc
Target supports max reduction for vectors.
@end table
diff --git a/gcc/testsuite/gcc.dg/vect/pr66251.c b/gcc/testsuite/gcc.dg/vect/pr66251.c
index 7f0c4bc..26afbc9 100644
--- a/gcc/testsuite/gcc.dg/vect/pr66251.c
+++ b/gcc/testsuite/gcc.dg/vect/pr66251.c
@@ -1,7 +1,7 @@
/* { dg-require-effective-target vect_int } */
/* { dg-require-effective-target vect_double } */
-/* { dg-require-effective-target vect_floatint_cvt } */
-/* { dg-require-effective-target vect_intfloat_cvt } */
+/* { dg-require-effective-target vect_doubleint_cvt } */
+/* { dg-require-effective-target vect_intdouble_cvt } */
/* { dg-require-effective-target vect_pack_trunc } */
/* { dg-require-effective-target vect_unpack } */
/* { dg-require-effective-target vect_hw_misalign } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-floatint-conversion-2.c b/gcc/testsuite/gcc.dg/vect/vect-floatint-conversion-2.c
index 27d248b..64fab38 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-floatint-conversion-2.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-floatint-conversion-2.c
@@ -36,4 +36,4 @@ main (void)
return main1 ();
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_floatint_cvt } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_doubleint_cvt } } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-3.c b/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-3.c
index 6eb4fec..78fc3da 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-3.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-3.c
@@ -35,4 +35,4 @@ int main (void)
return main1 ();
}
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_intfloat_cvt } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_intdouble_cvt } } } */
diff --git a/gcc/testsuite/gfortran.dg/vect/pr60510.f b/gcc/testsuite/gfortran.dg/vect/pr60510.f
index 5e2c085..202c1be 100644
--- a/gcc/testsuite/gfortran.dg/vect/pr60510.f
+++ b/gcc/testsuite/gfortran.dg/vect/pr60510.f
@@ -1,5 +1,6 @@
! { dg-do run }
! { dg-require-effective-target vect_double }
+! { dg-require-effective-target vect_intdouble_cvt }
! { dg-additional-options "-fno-inline -ffast-math" }
subroutine foo(a,x,y,n)
implicit none
diff --git a/gcc/testsuite/gfortran.dg/vect/vect-8.f90 b/gcc/testsuite/gfortran.dg/vect/vect-8.f90
index ec95598..8e18be5 100644
--- a/gcc/testsuite/gfortran.dg/vect/vect-8.f90
+++ b/gcc/testsuite/gfortran.dg/vect/vect-8.f90
@@ -704,4 +704,5 @@ CALL track('KERNEL ')
RETURN
END SUBROUTINE kernel
-! { dg-final { scan-tree-dump-times "vectorized 21 loops" 1 "vect" } }
+! { dg-final { scan-tree-dump-times "vectorized 21 loops" 1 "vect" { target { vect_intdouble_cvt } } } }
+! { dg-final { scan-tree-dump-times "vectorized 17 loops" 1 "vect" { target { ! vect_intdouble_cvt } } } }
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 539aaaf..4f752ec2 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -3119,6 +3119,68 @@ proc check_effective_target_vect_intfloat_cvt { } {
return $et_vect_intfloat_cvt_saved($et_index)
}
+# Return 1 if the target supports signed double->int conversion
+#
+
+proc check_effective_target_vect_doubleint_cvt { } {
+ global et_vect_doubleint_cvt_saved
+ global et_index
+
+ if [info exists et_vect_doubleint_cvt_saved($et_index)] {
+ verbose "check_effective_target_vect_doubleint_cvt: using cached result" 2
+ } else {
+ set et_vect_doubleint_cvt_saved($et_index) 0
+ if { (([istarget i?86-*-*] || [istarget x86_64-*-*])
+ && [check_no_compiler_messages vect_doubleint_cvt assembly {
+ #ifdef __tune_atom__
+ # error No double vectorizer support.
+ #endif
+ }])
+ || [istarget aarch64*-*-*]
+ || [istarget spu-*-*]
+ || ([istarget powerpc*-*-*] && [check_vsx_hw_available])
+ || ([istarget mips*-*-*]
+ && [et-is-effective-target mips_msa]) } {
+ set et_vect_doubleint_cvt_saved($et_index) 1
+ }
+ }
+
+ verbose "check_effective_target_vect_doubleint_cvt:\
+ returning $et_vect_doubleint_cvt_saved($et_index)" 2
+ return $et_vect_doubleint_cvt_saved($et_index)
+}
+
+# Return 1 if the target supports signed int->double conversion
+#
+
+proc check_effective_target_vect_intdouble_cvt { } {
+ global et_vect_intdouble_cvt_saved
+ global et_index
+
+ if [info exists et_vect_intdouble_cvt_saved($et_index)] {
+ verbose "check_effective_target_vect_intdouble_cvt: using cached result" 2
+ } else {
+ set et_vect_intdouble_cvt_saved($et_index) 0
+ if { (([istarget i?86-*-*] || [istarget x86_64-*-*])
+ && [check_no_compiler_messages vect_intdouble_cvt assembly {
+ #ifdef __tune_atom__
+ # error No double vectorizer support.
+ #endif
+ }])
+ || [istarget aarch64*-*-*]
+ || [istarget spu-*-*]
+ || ([istarget powerpc*-*-*] && [check_vsx_hw_available])
+ || ([istarget mips*-*-*]
+ && [et-is-effective-target mips_msa]) } {
+ set et_vect_intdouble_cvt_saved($et_index) 1
+ }
+ }
+
+ verbose "check_effective_target_vect_intdouble_cvt:\
+ returning $et_vect_intdouble_cvt_saved($et_index)" 2
+ return $et_vect_intdouble_cvt_saved($et_index)
+}
+
#Return 1 if we're supporting __int128 for target, 0 otherwise.
proc check_effective_target_int128 { } {
--
2.9.1
More information about the Gcc-patches
mailing list