New target check for double<->int conversions
authorAndreas Krebbel <krebbel@linux.vnet.ibm.com>
Wed, 4 Oct 2017 11:59:30 +0000 (11:59 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Wed, 4 Oct 2017 11:59:30 +0000 (11:59 +0000)
gcc/ChangeLog:

2017-10-04  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* doc/sourcebuild.texi: Document vect_intdouble_cvt and
vect_doubleint_cvt.

gcc/testsuite/ChangeLog:

2017-10-04  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.

From-SVN: r253406

gcc/ChangeLog
gcc/doc/sourcebuild.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr66251.c
gcc/testsuite/gcc.dg/vect/vect-floatint-conversion-2.c
gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-3.c
gcc/testsuite/gfortran.dg/vect/pr60510.f
gcc/testsuite/gfortran.dg/vect/vect-8.f90
gcc/testsuite/lib/target-supports.exp

index 2015b7fee849f0b2a9c4d917d5a3b7b918e45f38..fb76db2ec4a20e2d983de67967f116b9b6744697 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-04  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
+
+       * doc/sourcebuild.texi: Document vect_intdouble_cvt and
+       vect_doubleint_cvt.
+
 2017-10-04  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
 
        * doc/sourcebuild.texi: Document vect_long_mult.
index 4f25268bda88e481a82ef1c92dfefc1ae4d08372..e09bca102f030f4c3a4c6319d3881df9701c60cf 100644 (file)
@@ -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
index 68e0f055f2492b34d8640b3f4419fa0894f5b1e9..f06b7b2e74f087a6ec9fd413c042c1eeb795fc9f 100644 (file)
@@ -1,3 +1,18 @@
+2017-10-04  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.
+
 2017-10-04  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
 
        * gcc.dg/vect/pr60656.c: Check vect_long_mult.
index 7f0c4bcf29a2347c09be86c7a00c59b3af5bf301..26afbc96a5d57a49fbbac95753f4df006cb36018 100644 (file)
@@ -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 } */
index 27d248b9837748dbfd4f8404cfdd115af9f1b9ab..64fab3876310d60ca016b78938e449201c80997d 100644 (file)
@@ -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 } } } */
index 6eb4fec77ee314dd3310f2820f8fa42f773555c4..78fc3da481c6693611b45d3939fe03d23e84f8f7 100644 (file)
@@ -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 } } } */
index 5e2c085d76126de15232493b1c41d2b6426797ce..202c1be8ee4779fbd2a0c3a2195604eedd9a5ea4 100644 (file)
@@ -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
index ec955989c9ffb6fc2b0cc99de24f9d7b95ecdf84..8e18be5eebd2ab2746c8155cdf7bab076d641db5 100644 (file)
@@ -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 } } } }
index 539aaaf1490239cfafa86e9241956401ed6c61b3..4f752ec25290479d0ec5ccc9fbf38fd7484f1d21 100644 (file)
@@ -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 { } {