Mail Archives: djgpp/2003/08/26/10:06:53
Carlo (cbramix AT libero DOT it) wrote:
: I have this little problem: GCC doesn't seem to optimize very well a
: piece of code I wrote with 8 bit variables.
Really? You did turn on optimisations? Show us some code and what
you'd expect optimisationwise.
: So, I was thinking to use a local register variable.
: On the documentation I read that GCC can do that:
: register int *foo asm ("ebx");
: But what should I do if I need to use BH or BL registers?
: I tried to use BH or BL instead of ebx:
: register unsigned char myvar asm ("bl");
: GCC doesn't give me error messages, but it generates the same code I
: got without the 'asm' keyword.
Yes. That's because you misunderstood what that asm statement does. It
tells gcc to use the name "ebx" or "bl" for the assembly while you use
"foo" or "myvar" in C. Note that "ebx" and "bl" are names of variables,
not registers. So if it wasn't for the usual prepending of "_" saying
"int *ebx;" would be the same.
I'm unsure if the "register" keyword affects this, but I doubt it
does.
Right,
MartinS
- Raw text -