aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>2018-07-19 09:49:36 +0000
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>2018-07-19 09:49:36 +0000
commite0c27d52dd783affbc95bdb53630b35ae044e620 (patch)
tree78671068a29a8ff779e7a38e755a617b3e7544ca /gcc/testsuite
parentb4a3f1e98a2635bfc6ded2b84fa9cfd3b845017b (diff)
downloadgcc-e0c27d52dd783affbc95bdb53630b35ae044e620.zip
gcc-e0c27d52dd783affbc95bdb53630b35ae044e620.tar.gz
gcc-e0c27d52dd783affbc95bdb53630b35ae044e620.tar.bz2
[Fortran] Use MIN/MAX_EXPR or IFN_FMIN/MAX for min/max intrinsics when possible
* trans-intrinsic.c: (gfc_conv_intrinsic_minmax): Emit MIN_MAX_EXPR or IFN_FMIN/FMAX sequence to calculate the min/max when possible. * gfortran.dg/max_fmax_aarch64.f90: New test. * gfortran.dg/min_fmin_aarch64.f90: Likewise. * gfortran.dg/minmax_integer.f90: Likewise. From-SVN: r262876
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/max_fmax_aarch64.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/min_fmin_aarch64.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/minmax_integer.f9015
4 files changed, 51 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9f5489d..f78a7c8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-19 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * gfortran.dg/max_fmax_aarch64.f90: New test.
+ * gfortran.dg/min_fmin_aarch64.f90: Likewise.
+ * gfortran.dg/minmax_integer.f90: Likewise.
+
2018-07-19 Paolo Carlini <paolo.carlini@oracle.com>
* g++.old-deja/g++.mike/p784.C: Add -fpermissive.
diff --git a/gcc/testsuite/gfortran.dg/max_fmax_aarch64.f90 b/gcc/testsuite/gfortran.dg/max_fmax_aarch64.f90
new file mode 100644
index 0000000..b818241
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/max_fmax_aarch64.f90
@@ -0,0 +1,15 @@
+! { dg-do compile { target aarch64*-*-* } }
+! { dg-options "-O2 -fdump-tree-optimized" }
+
+subroutine foo (a, b, c, d, e, f, g, h)
+ real (kind=8) :: a, b, c, d, e, f, g, h
+ a = max (a, b, c, d, e, f, g, h)
+end subroutine
+
+subroutine foof (a, b, c, d, e, f, g, h)
+ real (kind=4) :: a, b, c, d, e, f, g, h
+ a = max (a, b, c, d, e, f, g, h)
+end subroutine
+
+
+! { dg-final { scan-tree-dump-times "\.FMAX " 14 "optimized" } }
diff --git a/gcc/testsuite/gfortran.dg/min_fmin_aarch64.f90 b/gcc/testsuite/gfortran.dg/min_fmin_aarch64.f90
new file mode 100644
index 0000000..009869b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/min_fmin_aarch64.f90
@@ -0,0 +1,15 @@
+! { dg-do compile { target aarch64*-*-* } }
+! { dg-options "-O2 -fdump-tree-optimized" }
+
+subroutine foo (a, b, c, d, e, f, g, h)
+ real (kind=8) :: a, b, c, d, e, f, g, h
+ a = min (a, b, c, d, e, f, g, h)
+end subroutine
+
+
+subroutine foof (a, b, c, d, e, f, g, h)
+ real (kind=4) :: a, b, c, d, e, f, g, h
+ a = min (a, b, c, d, e, f, g, h)
+end subroutine
+
+! { dg-final { scan-tree-dump-times "\.FMIN " 14 "optimized" } }
diff --git a/gcc/testsuite/gfortran.dg/minmax_integer.f90 b/gcc/testsuite/gfortran.dg/minmax_integer.f90
new file mode 100644
index 0000000..5b6be38
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/minmax_integer.f90
@@ -0,0 +1,15 @@
+! { dg-do compile }
+! { dg-options "-O2 -fdump-tree-optimized" }
+
+subroutine foo (a, b, c, d, e, f, g, h)
+ integer (kind=4) :: a, b, c, d, e, f, g, h
+ a = min (a, b, c, d, e, f, g, h)
+end subroutine
+
+subroutine foof (a, b, c, d, e, f, g, h)
+ integer (kind=4) :: a, b, c, d, e, f, g, h
+ a = max (a, b, c, d, e, f, g, h)
+end subroutine
+
+! { dg-final { scan-tree-dump-times "MIN_EXPR" 7 "optimized" } }
+! { dg-final { scan-tree-dump-times "MAX_EXPR" 7 "optimized" } }