Mail Archives: djgpp/1999/12/22/22:54:24
Since he did not write back, on this I will. I am having the same problem..
I cannot get the grx23 library to compile on djgpp running under
windows95/98/NT4. I have the latest gcc for djgpp 295... I have tried
everything I can think of and worked on it for days. Most everything I
have for djgpp compiles fine but this library and a few others that use
in-line assembly are having this same compile problem. (Forbidden
registers, AX, CX, DX it doesn't seem to matter.)
gcc -c -O6 -Wall -fomit-frame-pointer -I. -I./include -I../include
-I../addons/p
rint -I../addons/bmp utils/shiftscl.c -o utils/shiftscl.o
utils/shiftscl.c: In function `_GR_shift_scanline':
utils/shiftscl.c:48: Invalid `asm' statement:
utils/shiftscl.c:48: fixed or forbidden register 2 (cx) was spilled for
class CR
EG.
utils/shiftscl.c:102: Invalid `asm' statement:
utils/shiftscl.c:102: fixed or forbidden register 2 (cx) was spilled
for
class C
REG.
make.exe[1]: *** [utils/shiftscl.o] Error 1
make.exe[1]: Leaving directory `c:/djgpp/contrib/grx23/src'
make.exe: *** [libs] Error 2
C:\djgpp\contrib\grx23>
Below is the code it blows up on (src/utils/shiftscl.c), Blowup line
below denoted with a <><>. Can you tell me what can be done so it will
compile (preferred) or
if you can at lease email me the .a library files for djgpp that would
be sufficient.
Thanks in advance
Damon Hogan
Sr Programmer/Analyst
PGM, Inc.
# if defined(__GNUC__) && defined(__i386__)
int w = ws;
/* sad but true: the x86 bytesex forces this inefficient code :( */
asm volatile ("\n"
" movb (%3),%%ch \n"
" jmp 1f \n"
" .align 4,0x90 \n"
"1: decl %3 \n"
" movb %%ch,%%al \n"
" movb (%3),%%ah \n"
" movb %%ah,%%ch \n"
" shrl %%cl,%%eax \n"
" movb %%al,(%4) \n"
" decl %4 \n"
" decl %5 \n"
" jne 1b \n"
" shrb %%cl,%%ch \n"
" movb %%ch,(%4) "
: "=r" ((void *)s), "=r" ((void *)d), "=r" ((int)w)
: "0" ((void *)s), "1" ((void *)d), "2" ((int)w), "c" ((int)shift)
<><> : "ax", "cx"
);
# elif defined(__TURBOC__)
asm push ds ;
asm mov bx, ws ;
asm mov cl, shift ;
asm les di, d ;
asm lds si, s ;
asm mov ch,[si] ;
asm std ;
looprv:
asm dec si ;
asm mov al, ch ;
asm mov ah, [si] ;
asm mov ch, ah ;
asm shr ax, cl ;
asm stosb ;
asm dec bx ;
asm jnz short looprv ;
asm mov al, ch ;
asm shr al, cl ;
asm stosb ;
asm pop ds ;
# else
int w = ws;
do {
--s;
*(d--) = highlowP(s)>>shift;
} while (--w);
*d = *s >> shift;
# endif
And so it blows up on the line..
: "ax", "cx"
When throwing away registers at the end of the assembly routine because the
contents of those registers has changed...
Everything I have read so far says that this is valid... So I can't fix
something that
is supposed to work..
Any suggestions?
Nate Eldredge wrote:
> Anton Helm <tony AT dictator DOT nt DOT tuwien DOT ac DOT at> writes:
>
> > Is there some asm guru out there that can look into a 10-line inline asm
> > code that used to work with gcc 2.8.1 ?
>
> Post it.
>
> --
>
> Nate Eldredge
> neldredge AT hmc DOT edu
- Raw text -