On 9 Dec 2011, at 19:45, Aldy Hernandez wrote:
On 12/09/11 13:19, Jakub Jelinek wrote:
On Fri, Dec 09, 2011 at 08:17:04PM +0100, Dominique Dhumieres wrote:
+/* { dg-final { scan-assembler "movl.*, (_?var|\\(%)" } } */
It works for me too.
Except that when matching just , (% it doesn't test almost anything.
IMNSHO you should instead just test it { target !fpic } or similar.
Darwin is not the only target that defaults to PIC.
----
ISTM, in this particular instance, the check for
movl , (%
happens to be enough to detect the case Aldy is interested in (at
least for the code sequences Darwin generates).
Does this work for everyone?
... well that "works" for Darwin by not performing the test ..
.. might as well just skip the whole thing and save the cycles on the
compile ;-)
===
the problem in finding a match s that c and c++ generate different
sequences
- and the test is in the shared dir
... otherwise a target-dependent match would work ...
[[** I'm checking out whether it's feasible to switch off PIC for m64
Darwin .. so one could just do the test -fno-PIC ..
... works for m32 - but PIC is jammed on for x86/m64 ... ]]
Iain
it seems that each case is doing the correct thing ..
==
c / m32
L00000000001$pb:
movl L_var$non_lazy_ptr-L00000000001$pb(%ecx), %edx
movl (%edx), %eax
andb $15, %al
orl $80, %eax
movl %eax, (%edx)
ret
c / m64
_setit:
LFB0:
movq _var@GOTPCREL(%rip), %rdx
movl (%rdx), %eax
andb $15, %al
orl $80, %eax
movl %eax, (%rdx)
ret
===
c++ / m32
__Z5setitv:
LFB0:
call ___x86.get_pc_thunk.cx
L00000000001$pb:
movl _var-L00000000001$pb(%ecx), %eax
andb $15, %al
orl $80, %eax
movl %eax, _var-L00000000001$pb(%ecx)
ret
c++ / m64
__Z5setitv:
LFB0:
movl _var(%rip), %eax
andb $15, %al
orl $80, %eax
movl %eax, _var(%rip)
ret