Mail Archives: djgpp/1996/12/14/16:06:12
Aaron m Clemmer wrote:
>
> Ok, I've been scouring the info files for help, but they don't
> mention this problem, so...
> I have a function that is declared inline, it has inline assembly
> in it. It works fine with optimization off, but doesn't compile with it
> on. The error message is 'symbol not defined', where the symbol is the
> label that I'm trying to jump to. It only complains when I'm jumping to
> a label prior to the jump instruction. I tried someones suggestion of
> appending 'b' to 'jnz label1', but that would't compile. Anyways, here
> is the soure.
>
> extern __inline__ fixed32 FixedSqrtLP(fixed32 n)
> {
> fixed32 value=0;
> __asm__ __volatile__ ("xor %%eax, %%eax \n"
> "mov $0x40000000, %%ebx \n"
> "sqrtLP1: mov %%ecx, %%edx \n" // This is the label that I'm
> jumping to
> "sub %%ebx, %%edx \n"
> "jl sqrtLP2 \n"
> "sub %%eax, %%edx \n"
> "jl sqrtLP2 \n"
> "mov %%edx, %%ecx \n"
> "shr $1, %%eax \n"
> "or %%ebx, %%eax \n"
> "shr $2, %%ebx \n"
> "jnz sqrtLP1 \n" // this jump won't work
> "shl $8, %%eax \n"
> "jmp sqrtLP3 \n"
> "sqrtLP2: shr $1, %%eax \n"
> "shr $2, %%ebx \n"
> "jnz sqrtLP1 \n" // this one won't either
> "shl $8, %%eax \n"
> "sqrtLP3: nop \n"
> : "=a" (value)
> : "c" (n)
> : "eax", "ebx", "ecx", "edx");
> return value;
> }
>
> I'm calling it like this:
>
> int main() {
> FixedSqrtLP(num);
> FixedSqrtLP(num);
> return 0;
> }
>
> And compile it like this:
> gcc -O3 -o test.exe test.cc
>
> thanks,
> aaron
I had this problem, too. Everytime a label is defined before
a jump instruction calls it, the compiler generates error messages.
I've tried things like:
asm (" cmp %edx, $1200
jge SKIP
inc edx
SKIP:
...
");
No error messages generated if the label is defined after the jump.
I am using DJGPP v2.0, would v2.01 better?
- Raw text -