adam@bsw.UUCP (Adam de Boor) (06/22/89)
The constraints for the GCC asm statements distributed in the Purdue patches
(level 2.1) were wrong in several places. Below is a patch to correct
them. They've been tested on a Sun 3/50 running os 3.5 with all parts of
the X11 system compiled with -O -fstrength-reduce -fcombine-regs
-finline-functions using a beta-test version of gcc 1.36.
I'm pretty certain of the VAX constraints as well, but I've not tested them,
since I don't have a VAX handy...
a
*** /tmp/,RCSt1a07817 Wed Jun 21 14:12:40 1989
--- maskbits.h Wed Jun 21 14:12:34 1989
***************
*** 315,347 ****
#ifdef vax
#define FASTGETBITS(psrc,x,w,dst) \
asm ("extzv %1,%2,%3,%0" \
! : "g" (dst) \
! : "g" (x), "g" (w), "m" (*(char *)(psrc)))
#define getbits(psrc,x,w,dst) FASTGETBITS(psrc,x,w,dst)
#define FASTPUTBITS(src, x, w, pdst) \
asm ("insv %3,%1,%2,%0" \
! : "m" (*(char *)(pdst)) \
! : "g" (x), "g" (w), "g" (src))
#define putbits(src, x, w, pdst) FASTPUTBITS(src, x, w, pdst)
#endif vax
#ifdef mc68020
! #define FASTGETBITS(psrc, x, w, dst) \
! asm ("bfextu %3{%1:%2},%0" \
! : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc)))
#define getbits(psrc,x,w,dst) \
{ \
! FASTGETBITS(psrc, x, w, dst);\
! dst <<= (32-(w)); \
}
#define FASTPUTBITS(src, x, w, pdst) \
! asm ("bfins %3,%0{%1:%2}" \
! : "=o" (*(char *)(pdst)) \
! : "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst)))
!
! #define putbits(src, x, w, pdst) FASTPUTBITS(((src) >> (32-(w))), x, w, pdst)
#endif mc68020
#endif __GNUC__
--- 315,352 ----
#ifdef vax
#define FASTGETBITS(psrc,x,w,dst) \
asm ("extzv %1,%2,%3,%0" \
! : "=g" (dst) \
! : "g" (x), "g" (w), "m" (*(unsigned int *)(psrc)))
#define getbits(psrc,x,w,dst) FASTGETBITS(psrc,x,w,dst)
#define FASTPUTBITS(src, x, w, pdst) \
asm ("insv %3,%1,%2,%0" \
! : "=m" (*(unsigned int *)(pdst)) \
! : "g" (x), "g" (w), "g" (src), "0" (*(unsigned int *)(pdst)))
#define putbits(src, x, w, pdst) FASTPUTBITS(src, x, w, pdst)
#endif vax
#ifdef mc68020
! /*
! * Alternative constraints are because the Sun 3.5 assembler (and probably
! * 4.0 as well) can't deal with a mix of dn and #n for the bitfield specifiers,
! * though the 68020 is perfectly happy with it.
! */
! #define FASTGETBITS(psrc,x,w,dst) \
! asm ("bfextu %3{%b1:%b2},%0" \
! : "=d,=d" (dst) \
! : "d,i" (x), "d,i" (w), "od,od" (*(unsigned int *)(psrc)));
#define getbits(psrc,x,w,dst) \
{ \
! FASTGETBITS(psrc,x,w,dst)\
! dst <<= 32-w; \
}
#define FASTPUTBITS(src, x, w, pdst) \
! asm ("bfins %3,%0{%b1:%b2}" \
! : "=od,=od" (*(unsigned int *)(pdst)) \
! : "d,i" (x), "d,i" (w), "d,d" (src), "0,0" (*(unsigned int *)(pdst)));
! #define putbits(src, x, w, pdst) {FASTPUTBITS(((src) >> 32-(w)), x, w, pdst)}
#endif mc68020
#endif __GNUC__