From ee050a6e44bf73f876cba57f85aeb39cca8ae952 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Wed, 20 Dec 2017 09:50:56 +0100 Subject: [PATCH] Add two test-cases for (PR middle-end/82404). 2017-12-20 Martin Liska PR middle-end/82404 * g++.dg/pr82404.C: New test. * gcc.dg/pr82404.c: New test. From-SVN: r255851 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/pr82404.C | 17 +++++++++++++++++ gcc/testsuite/gcc.dg/pr82404.c | 17 +++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 gcc/testsuite/g++.dg/pr82404.C create mode 100644 gcc/testsuite/gcc.dg/pr82404.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aaa8c0551fe..50bd37b3166 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-12-20 Martin Liska + + PR middle-end/82404 + * g++.dg/pr82404.C: New test. + * gcc.dg/pr82404.c: New test. + 2017-12-20 Julia Koval * gcc.target/i386/avx-1.c: Handle new intrinsics. diff --git a/gcc/testsuite/g++.dg/pr82404.C b/gcc/testsuite/g++.dg/pr82404.C new file mode 100644 index 00000000000..9d860714865 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr82404.C @@ -0,0 +1,17 @@ +// PR middle-end/82404 + +// { dg-do compile } +// { dg-options "-O3 -Wall -fdump-tree-optimized -Wno-return-type" } + +enum eShape { eSquare, eCircle, eShpere, eTetraeder }; + +double test_switch_native(enum eShape shape, double r) { + switch(shape) { + case eSquare: return 2; + case eCircle: return 3; + case eShpere: return 4; + case eTetraeder: return 5; + } +} + +// { dg-final { scan-tree-dump-not "if " optimized } } diff --git a/gcc/testsuite/gcc.dg/pr82404.c b/gcc/testsuite/gcc.dg/pr82404.c new file mode 100644 index 00000000000..53565d310f5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr82404.c @@ -0,0 +1,17 @@ +// PR middle-end/82404 + +// { dg-do compile } +// { dg-options "-O3 -Wall -fdump-tree-optimized -Wno-return-type" } + +enum eShape { eSquare, eCircle, eShpere, eTetraeder }; + +double test_switch_native(enum eShape shape, double r) { + switch(shape) { + case eSquare: return 2; + case eCircle: return 3; + case eShpere: return 4; + case eTetraeder: return 5; + } +} + +// { dg-final { scan-tree-dump-times "if " 1 optimized } } -- 2.30.2