This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR37216 [cygming] Invalid alignment for SSE store to .comm data generated with -O3


Hello!

  Bootstrapped on i686-pc-cygwin, and verified that it fixes 48 FAILs caused
by the gcc.dg/torture/stackalign/push-1.c test.  Also verified that when you
build it (non-bootstrap) without support in the assembler, the autoconf test
correctly detects this and sets the target option off by default.  Also read
the generated assembly files to verify they were emitting the correct forms of
the directive.

  Full testsuite now running on C, C++, Fortran and Java; will probably take
around two days to complete.

gcc/ChangeLog:

	PR target/37216
	* configure.ac (HAVE_GAS_ALIGNED_COMM):  Add autoconf test and
	macro definition for support of three-operand format aligned
	.comm directive in assembler on cygwin/pe/mingw target OS.
	* configure:  Regenerate.
	* config.h:  Regenerate.
	* doc/invoke.texi (-mpe-aligned-commons):  Document new target option.
	* config/i386/cygming.opt (-mpe-aligned-commons):  Add new option.
	* config/i386/winnt.c (i386_pe_asm_output_aligned_decl_common):  Use
	aligned form of .comm directive if -mpe-aligned-commons is in effect.

If no regressions when the tests complete, OK for HEAD?

A testcase should also be added that exercises this new option through whole toolchain. I'd like to propose attached patch. where we check that -mpe-aligned-commons code is effective all the way to the object file. If the object file can be created without messages/problems, then we run the target specific testcase with -mpe-aligned-commons option. OTOH, the testcase will fail on windows targets with unpatched binutils, indicating that something is wrong with the toolchain.


(The patch was not tested on real windows targets, but I'm pretty confident it works as advertised.)

Uros.
Index: gcc.target/i386/pr37216.c
===================================================================
--- gcc.target/i386/pr37216.c	(revision 0)
+++ gcc.target/i386/pr37216.c	(revision 0)
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -msse2" } */
+/* { dg-options "-O3 -msse2 -mpe-aligned-commons" { target pe_aligned_commons } } */
+
+#include "sse2-check.h"
+
+int iarr[64];
+int iint = 0;
+
+void
+sse2_test (void)
+{
+  int i;
+
+  for (i = 0; i < 64; i++)
+    iarr[i] = -2;
+}
Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp	(revision 147824)
+++ lib/target-supports.exp	(working copy)
@@ -611,6 +611,18 @@
     } "-pthread"]
 }
 
+# Return 1 if compilation with -mpe-aligned-commons is error-free
+# for trivial code, 0 otherwise.
+
+proc check_effective_target_pe_aligned_commons {} {
+    if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
+	return [check_no_compiler_messages pe_aligned_commons object {
+	    int foo;
+	} "-mpe-aligned-commons"]
+    }
+    return 0
+}
+
 # Return 1 if the target supports -fstack-protector
 proc check_effective_target_fstack_protector {} {
     return [check_runtime fstack_protector {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]