Stupid GCC inline assembly CANNOT even handle local variable

Programming, for all ages and all languages.
xuancong
Posts: 14
Joined: Fri Jul 02, 2010 9:15 pm

Re: Stupid GCC inline assembly CANNOT even handle local vari

Post by xuancong »

And also "mov (x+4),%eax" is not supported by GCC, you get a compile error.
Yes, that's pure AT&T syntax, not inline assembly.

Sure, AT&T syntax should support, but GCC inline asm doesn't support. We're talking about different things.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Stupid GCC inline assembly CANNOT even handle local vari

Post by pcmattman »

If you use the 'm' constraint you should be passing a specific location (calculated in your C code) - GCC will do all the offsets for you.

As an example, with a uint32_t array "t", you can use the "m" constraint with t[1]. This will let GCC do all the offset stuff (4 bytes) and save you the trouble.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Stupid GCC inline assembly CANNOT even handle local vari

Post by Solar »

xuancong wrote:So you still cannot solve the problem, right?
Not for someone with your attitude, no.
Every good solution is obvious once you've found it.
xuancong
Posts: 14
Joined: Fri Jul 02, 2010 9:15 pm

Re: Stupid GCC inline assembly CANNOT even handle local vari

Post by xuancong »

Solar wrote:
xuancong wrote:So you still cannot solve the problem, right?
Not for someone with your attitude, no.
I've solved half of the problem under someone's help and have modified the initial post. Please check!
quok
Member
Member
Posts: 490
Joined: Wed Oct 18, 2006 10:43 pm
Location: Kansas City, KS, USA

Re: Stupid GCC inline assembly CANNOT even handle local vari

Post by quok »

xuancong wrote:I've solved half of the problem under someone's help and have modified the initial post. Please check!
Sigh, I hate it when people do that. I get so tempted to disable editing of posts whenever I see someone do this. Congratulations, you've just thrown the entire thread out of whack. Nothing here makes sense anymore. ](*,)
xuancong
Posts: 14
Joined: Fri Jul 02, 2010 9:15 pm

Re: Stupid GCC inline assembly CANNOT even handle local vari

Post by xuancong »

quok wrote:
xuancong wrote:I've solved half of the problem under someone's help and have modified the initial post. Please check!
Sigh, I hate it when people do that. I get so tempted to disable editing of posts whenever I see someone do this. Congratulations, you've just thrown the entire thread out of whack. Nothing here makes sense anymore. ](*,)
Well, it's not that bad actually. Since none of the replies in the entire thread solves the actual problem. Nonetheless, the issue is still there that GCC still need to be improved.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Stupid GCC inline assembly CANNOT even handle local vari

Post by Solar »

xuancong wrote:Since none of the replies in the entire thread solves the actual problem. Nonetheless, the issue is still there that GCC still need to be improved.
/me glances towards the mods.

"Can I get five minutes alone with him? I won't hurt him too much."

Just in case you didn't get it already:

GCC inline assembly does the job it has been designed to do, and does it well.

And second:

The problem right now is that you apparently cannot wrap your mind around the concept that a "solution" does not necessarily include someone solving your problem for you, but will involve you doing some thinking on your own. Pointers have been given in plenty.

Request this thread to be closed. I see flames licking up through the floorboards.
Every good solution is obvious once you've found it.
quok
Member
Member
Posts: 490
Joined: Wed Oct 18, 2006 10:43 pm
Location: Kansas City, KS, USA

Re: Stupid GCC inline assembly CANNOT even handle local vari

Post by quok »

Solar wrote:Request this thread to be closed. I see flames licking up through the floorboards.
Request granted.
Locked