diff mbox

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

Message ID 4EE24A6E.70904@redhat.com
State New
Headers show

Commit Message

Aldy Hernandez Dec. 9, 2011, 5:50 p.m. UTC
> scan-assembler can be target-dependent if that would (as I read the
> above) help.

Well, whadayaknow...

In that case we can have an x86 variant for Darwin, and one for 
everything else x86.

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

Comments

Iain Sandoe Dec. 9, 2011, 6:28 p.m. UTC | #1
On 9 Dec 2011, at 17:50, Aldy Hernandez wrote:

>
>> scan-assembler can be target-dependent if that would (as I read the
>> above) help.
>
> Well, whadayaknow...
>
> In that case we can have an x86 variant for Darwin, and one for  
> everything else x86.

in principle, it should be OK ...   with *-*-darwin*

the problem is that c and c++ are generating different code sequences.

c does this (m64):

>   movq    _var@GOTPCREL(%rip), %rdx
>   movl    (%rdx), %eax
>   andb    $15, %al
>   orl    $80, %eax
>   movl    %eax, (%rdx)

c++ does this (m64):

__Z5setitv:
LFB0:
         movl    _var(%rip), %eax
         andb    $15, %al
         orl     $80, %eax
         movl    %eax, _var(%rip)
         ret

so .. m64 c++ is the same as 'other' cases (less the  
__USER_LABEL_PREFIX__)

there are 4 cases: {c,c++} {m32,m64} with 4 different asm outputs

if that is a 'reasonable' situation - then might need to include ilp64/ 
ip32 in the target spec ...

otherwise - if it indicates a bug - then .. we need to deal with that.

Iain
Aldy Hernandez Dec. 9, 2011, 6:52 p.m. UTC | #2
> there are 4 cases: {c,c++} {m32,m64} with 4 different asm outputs
>
> if that is a 'reasonable' situation - then might need to include
> ilp64/ip32 in the target spec ...

Both the 32 and 64 bit versions of the Darwin output are correct, so 
perhaps something like I had originally proposed, but taking into 
account the __USER_LABEL_PREFIX__:

-/* { dg-final { scan-assembler "movl.*, var" } } */
+/* { dg-final { scan-assembler "movl.*, (_?var|\\(%)" } } */
Iain Sandoe Dec. 9, 2011, 7:08 p.m. UTC | #3
On 9 Dec 2011, at 18:52, Aldy Hernandez wrote:

>
>> there are 4 cases: {c,c++} {m32,m64} with 4 different asm outputs
>>
>> if that is a 'reasonable' situation - then might need to include
>> ilp64/ip32 in the target spec ...
>
> Both the 32 and 64 bit versions of the Darwin output are correct, so  
> perhaps something like I had originally proposed, but taking into  
> account the __USER_LABEL_PREFIX__:
>
> -/* { dg-final { scan-assembler "movl.*, var" } } */
> +/* { dg-final { scan-assembler "movl.*, (_?var|\\(%)" } } */

works for me .. but I can't approve it :-).
Iain
diff mbox

Patch

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,5 @@  void setit()
   var.j = 5;
 }
 
-/* { dg-final { scan-assembler "movl.*, var" } } */
+/* { dg-final { scan-assembler "movl.*, \\(%" { target *-*-darwin } } } */
+/* { dg-final { scan-assembler "movl.*, var" { target { ! *-*-darwin } } } } */