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]

PR/50076 make c-c++-common/cxxbitfields-3.c work in Darwin


This test is somewhat problematic in that it's entirely dependent on the assembler output. It's not reproducible on non-x86, so I couldn't make it part of the simulate-thread framework.

What we're really testing is that the last move into "var" happens as a 32/64 bit quantity:

        movl    var(%rip), %eax
        andb    $15, %al
        orl     $80, %eax
        movl    %eax, var(%rip)		<-- good

Currently the regexp is testing a movl into "var", however on Darwin there is an extra level of indirection through GOTPCREL, so we don't explicitly store into "var". The result is correct, but doesn't match the regexp:

    movq    _var@GOTPCREL(%rip), %rdx
    movl    (%rdx), %eax
    andb    $15, %al
    orl    $80, %eax
    movl    %eax, (%rdx)		<-- bad, no "var"

The two simple solutions I can think of are (a) modifying the regexp as below (b) XFAILing on Darwin. I would prefer (a), but I want to make sure I'm not overlooking something.

Does this seem reasonable or is another approach preferable?

testsuite/
	* c-c++-common/cxxbitfields-3.c: Adjust regexp.

Index: testsuite/c-c++-common/cxxbitfields-3.c
===================================================================
--- testsuite/c-c++-common/cxxbitfields-3.c	(revision 182028)
+++ testsuite/c-c++-common/cxxbitfields-3.c	(working copy)
@@ -18,4 +18,4 @@ void setit()
   var.j = 5;
 }

-/* { dg-final { scan-assembler "movl.*, var" } } */
+/* { dg-final { scan-assembler "movl.*, (var|\\(%)" } } */


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