aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-09-19 09:57:16 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-09-19 10:03:10 -0700
commitc66c004ad610f4f02d5f065fe29c4c10f05ae13f (patch)
treee384d65e3da2b41a176de4e95b8016229ff2cc6a /gcc
parente5d72c840a226fdbab65912f97d42a1dbdaf6ed2 (diff)
downloadgcc-c66c004ad610f4f02d5f065fe29c4c10f05ae13f.zip
gcc-c66c004ad610f4f02d5f065fe29c4c10f05ae13f.tar.gz
gcc-c66c004ad610f4f02d5f065fe29c4c10f05ae13f.tar.bz2
x86: Add a testcase for PR target/96861
Add a testcase to verify that -march=skylake-avx512 -mtune=skylake-avx512 generates desired code sequence. PR target/96861 * gcc.target/i386/pr96861.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.target/i386/pr96861.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/pr96861.c b/gcc/testsuite/gcc.target/i386/pr96861.c
new file mode 100644
index 0000000..7b7aecc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr96861.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mstv -march=skylake-avx512 -mtune=skylake-avx512" } */
+
+#define max(a,b) (((a) > (b))? (a) : (b))
+#define min(a,b) (((a) < (b))? (a) : (b))
+
+int smax1(int x)
+{
+ return max(x,1);
+}
+
+int smin1(int x)
+{
+ return min(x,1);
+}
+
+int smaxm1(int x)
+{
+ return max(x,-1);
+}
+
+int sminm1(int x)
+{
+ return min(x,-1);
+}
+
+unsigned int umax1(unsigned int x)
+{
+ return max(x,1);
+}
+
+unsigned int umin1(unsigned int x)
+{
+ return min(x,1);
+}
+
+/* { dg-final { scan-assembler-times "test" 6 } } */
+/* { dg-final { scan-assembler-not "cmp" } } */