From 30d027da83cdcc174747ce19381525a16c4a4503 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Wed, 4 Oct 2017 11:59:30 +0000 Subject: [PATCH] New target check for double<->int conversions gcc/ChangeLog: 2017-10-04 Andreas Krebbel * doc/sourcebuild.texi: Document vect_intdouble_cvt and vect_doubleint_cvt. gcc/testsuite/ChangeLog: 2017-10-04 Andreas Krebbel * 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 | 5 ++ gcc/doc/sourcebuild.texi | 6 ++ gcc/testsuite/ChangeLog | 15 +++++ 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 +++++++++++++++++++ 9 files changed, 95 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2015b7fee84..fb76db2ec4a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-10-04 Andreas Krebbel + + * doc/sourcebuild.texi: Document vect_intdouble_cvt and + vect_doubleint_cvt. + 2017-10-04 Andreas Krebbel * doc/sourcebuild.texi: Document vect_long_mult. diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 4f25268bda8..e09bca102f0 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/ChangeLog b/gcc/testsuite/ChangeLog index 68e0f055f24..f06b7b2e74f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2017-10-04 Andreas Krebbel + + * 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 * gcc.dg/vect/pr60656.c: Check vect_long_mult. diff --git a/gcc/testsuite/gcc.dg/vect/pr66251.c b/gcc/testsuite/gcc.dg/vect/pr66251.c index 7f0c4bcf29a..26afbc96a5d 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 27d248b9837..64fab387631 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 6eb4fec77ee..78fc3da481c 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 5e2c085d761..202c1be8ee4 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 ec955989c9f..8e18be5eebd 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 539aaaf1490..4f752ec2529 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.30.2