From 47e40520dd179ca1154a73894145bfba17e9d3fc Mon Sep 17 00:00:00 2001 From: Robert Drehmel Date: Sun, 20 Oct 2002 22:50:13 +0000 Subject: [PATCH] Do not try to work around ``poor (un)sign extension code'' creation by GCC-2.6.3. Casting pointers to unsigned char to volatile pointers to unsigned char seemed to produce better results on the ia32 architecture with old versions of GCC. The current FreeBSD system compiler GCC-3.2.1 emits better sign extension code for non-volatile variables: volatile char c; int i = c; is compiled to: ... movb -1(%ebp), %al movbsl %al, %eax movl %eax, -8(%ebp) ... char c; int i = c; is compiled to: ... movbsl -1(%ebp), %eax movl %eax, -8(%ebp) ... The same holds for zero-extension of dereferenced pointers to volatile unsigned char. When compiled on alpha or sparc64, the code produced for the two examples above does not differ. --- sys/dev/syscons/sctermvar.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/sys/dev/syscons/sctermvar.h b/sys/dev/syscons/sctermvar.h index d2c278ab67f4..b1c01af1f800 100644 --- a/sys/dev/syscons/sctermvar.h +++ b/sys/dev/syscons/sctermvar.h @@ -322,17 +322,7 @@ sc_term_gen_print(scr_stat *scp, u_char **buf, int *len, int attr) cnt = imin(l, scp->xsize - scp->xpos); i = cnt; do { - /* - * gcc-2.6.3 generates poor (un)sign extension code. - * Casting the pointers in the following to volatile - * should have no effect, but in fact speeds up this - * inner loop from 26 to 18 cycles (+ cache misses) - * on i486's. - * XXX: out of date? - */ -#define UCVP(ucp) ((u_char volatile *)(ucp)) - p = sc_vtb_putchar(&scp->vtb, p, - UCVP(map)[*UCVP(ptr)], attr); + p = sc_vtb_putchar(&scp->vtb, p, map[*ptr], attr); ++ptr; --i; } while ((i > 0) && PRINTABLE(*ptr));