Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 11th, 2005, 6:53 PM   #1
earl
Newbie
 
Join Date: Jun 2005
Posts: 18
Rep Power: 0 earl is on a distinguished road
Inline asm - earlyclobber operand

With GCC, the '&' character can be used to specify an "earlyclobber" operand of asm modules. I was reading a piece of code that used this for an output constraint, and got into reading more about what it's for. I'm pretty confused by the generic definition that seems to be everywhere I look, however..

Quote:
Means (in a particular alternative) that this operand is an earlyclobber operand, which is modified before the instruction is finished using the input operands. Therefore, this operand may not lie in a register that is used as an input operand or as part of any memory address.

& applies only to the alternative in which it is written. In constraints with multiple alternatives, sometimes one alternative requires & while others do not. See, for example, the movdf insn of the 68000.

An input operand can be tied to an earlyclobber operand if its only use as an input occurs before the early result is written. Adding alternatives of this form often allows GCC to produce better code when only some of the inputs can be affected by the earlyclobber.

& does not obviate the need to write =
Could anybody explain this more clearly? I understand the concept of a clobber list, which is separate from the specific constraints, but I'm confused as to how this applies to a specific operand.
earl is offline   Reply With Quote
Old Jul 11th, 2005, 8:29 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
I personally consider that "feature" of gcc to be harder and more confusing than just writing the dam' assembly code, so I don't use it. I suspect the early clobber thing is where an intermediate result would be stored, so you wouldn't want to use it for anything that has other uses upcoming, like one of the inputs.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:08 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC