Subject: C compiler (/lib/c1) u_char improvement (#77) Index: lib/ccom/optable 2.11BSD Description: The C compiler doesn't know it can use the same 'bitb' instructions for u_char as it can for char. This results in extra instructions being generated to promote the u_char to int before doing a 'bit'. This type of construct occurs fairly frequently in the networking code because various flag fields are u_char in type. Repeat-By: Compile the test program (using "cc -O -S"): char *b; unsigned char *c; main() { if ((b[1] & 4) == 0) exit(2); if ((c[1] & 4) == 0) exit(1); } Note that the code reads: .comm _b,2 .comm _c,2 .globl _main .text _main: ~~main: jsr r5,csv mov _b,r0 bitb $4,1(r0) jne L4 mov $2,(sp) jsr pc,*$_exit L4: mov _c,r0 movb 1(r0),r0 /* XXX */ bic $!377,r0 /* XXX */ bit $4,r0 jne L3 mov $1,(sp) jsr pc,*$_exit L3: jmp cret .globl .data Instead of: .comm _b,2 .comm _c,2 .globl _main .text _main: ~~main: jsr r5,csv mov _b,r0 bitb $4,1(r0) jne L4 mov $2,(sp) jsr pc,*$_exit L4: mov _c,r0 bitb $4,1(r0) jne L3 mov $1,(sp) jsr pc,*$_exit L3: jmp cret .globl .data Fix: Apply the patch below and reinstall 'c1'. ==============================cut here============================== *** /usr/src/lib/ccom/optable.old Wed Oct 23 07:02:57 1991 --- /usr/src/lib/ccom/optable Tue Jul 28 09:35:00 1992 *************** *** 1839,1844 **** --- 1839,1846 ---- IBE R,A1 %n*,a + %nu*,a + %nub*,a % [move6] %n,a