public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* GCC4 x86_64 pushfl / pop %eax inline asm ?
@ 2006-06-14 16:59 Darryl Miles
  2006-06-14 17:08 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Darryl Miles @ 2006-06-14 16:59 UTC (permalink / raw)
  To: gcc-help



How do I do this with GCC 4 ?  This works with GCC3 on i386, but not on 
GCC4 on x86_64.  Any advise on what #ifdef to put in place or if there 
is one way that works with both GCC versions ?

 From the output of GCC test.c => test.s

#APP

        pushfl
        popl %eax

#NO_APP

Yeilds errors on GCC4 x86_64:

test.s:2287: Error: suffix or operands invalid for `pushf'
test.s:2288: Error: suffix or operands invalid for `pop'


Thanks

Darryl

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: GCC4 x86_64 pushfl / pop %eax inline asm ?
  2006-06-14 16:59 GCC4 x86_64 pushfl / pop %eax inline asm ? Darryl Miles
@ 2006-06-14 17:08 ` Ian Lance Taylor
  2006-06-14 17:19   ` Darryl Miles
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2006-06-14 17:08 UTC (permalink / raw)
  To: Darryl Miles; +Cc: gcc-help

Darryl Miles <darryl-mailinglists@netbauds.net> writes:

> How do I do this with GCC 4 ?  This works with GCC3 on i386, but not
> on GCC4 on x86_64.  Any advise on what #ifdef to put in place or if
> there is one way that works with both GCC versions ?
> 
>  From the output of GCC test.c => test.s
> 
> #APP
> 
>         pushfl
>         popl %eax
> 
> #NO_APP
> 
> Yeilds errors on GCC4 x86_64:
> 
> test.s:2287: Error: suffix or operands invalid for `pushf'
> test.s:2288: Error: suffix or operands invalid for `pop'

Those errors are coming from the assembler.  This is an assembler
issue, not a gcc issue.

This one happens to be simple: the x86_64 does not have a pushfl
instruction.  Read the fine manual.  The x86_64 does have a pushfq
instruction.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: GCC4 x86_64 pushfl / pop %eax inline asm ?
  2006-06-14 17:08 ` Ian Lance Taylor
@ 2006-06-14 17:19   ` Darryl Miles
  0 siblings, 0 replies; 3+ messages in thread
From: Darryl Miles @ 2006-06-14 17:19 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Ian Lance Taylor wrote:
> Darryl Miles <darryl-mailinglists@netbauds.net> writes:
> 
>> test.s:2287: Error: suffix or operands invalid for `pushf'
>> test.s:2288: Error: suffix or operands invalid for `pop'
> 
> Those errors are coming from the assembler.  This is an assembler
> issue, not a gcc issue.

Sorry yes, I meant assembler, hence the use of .s files.


> This one happens to be simple: the x86_64 does not have a pushfl
> instruction.  Read the fine manual.  The x86_64 does have a pushfq
> instruction.

Ah, I was not aware of that, I'm porting existing code and was expecting 
the same instructions to exist.  Thanks for his pointer I have now got 
my code to compile again for both targets.

Thanks for your help!

Darryl

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-06-14 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-14 16:59 GCC4 x86_64 pushfl / pop %eax inline asm ? Darryl Miles
2006-06-14 17:08 ` Ian Lance Taylor
2006-06-14 17:19   ` Darryl Miles

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).