aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2025-02-24 05:44:40 +0800
committerH.J. Lu <hjl.tools@gmail.com>2025-02-24 05:54:26 +0800
commitbf0aa9dc8826b1d2a71e52754c117228134825b5 (patch)
tree29059aa514f8ebcbd621b91a49075d169705d024 /gcc
parent4cc54ed1f0e56299e2ec1f9323fc1dbb477b7233 (diff)
downloadgcc-bf0aa9dc8826b1d2a71e52754c117228134825b5.zip
gcc-bf0aa9dc8826b1d2a71e52754c117228134825b5.tar.gz
gcc-bf0aa9dc8826b1d2a71e52754c117228134825b5.tar.bz2
x86: Add tests for PR tree-optimization/82142
Verify that PR tree-optimization/82142 testcase is properly optimized. PR tree-optimization/82142 * gcc.target/i386/pr82142a.c: New file. * gcc.target/i386/pr82142b.c: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82142a.c32
-rw-r--r--gcc/testsuite/gcc.target/i386/pr82142b.c20
2 files changed, 52 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/pr82142a.c b/gcc/testsuite/gcc.target/i386/pr82142a.c
new file mode 100644
index 0000000..a40c038
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82142a.c
@@ -0,0 +1,32 @@
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mno-avx -msse2" } */
+/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */
+/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */
+
+/*
+**assignzero:
+**.LFB0:
+** .cfi_startproc
+** pxor %xmm0, %xmm0
+** movups %xmm0, 32\(%(?:r|e)di\)
+** movups %xmm0, \(%(?:r|e)di\)
+** movups %xmm0, 16\(%(?:r|e)di\)
+** movups %xmm0, 44\(%(?:r|e)di\)
+** ret
+**...
+*/
+
+typedef struct
+{
+ int a, b, c;
+ char j, k, k1;
+ int l, m, n[8];
+ char c1, c2;
+} foo;
+
+void
+assignzero (foo *p)
+{
+ foo tmp = {};
+ *p = tmp;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr82142b.c b/gcc/testsuite/gcc.target/i386/pr82142b.c
new file mode 100644
index 0000000..b1bf12d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr82142b.c
@@ -0,0 +1,20 @@
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O2 -mno-avx -msse2" } */
+/* Keep labels and directives ('.cfi_startproc', '.cfi_endproc'). */
+/* { dg-final { check-function-bodies "**" "" "" { target "*-*-*" } {^\t?\.} } } */
+
+/*
+**assignzero:
+**.LFB0:
+** .cfi_startproc
+** movl 4\(%esp\), %eax
+** pxor %xmm0, %xmm0
+** movups %xmm0, 32\(%eax\)
+** movups %xmm0, \(%eax\)
+** movups %xmm0, 16\(%eax\)
+** movups %xmm0, 44\(%eax\)
+** ret
+**...
+*/
+
+#include "pr82142a.c"