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|\\(%)" } } */

Reply via email to