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.
This commit is contained in:
Robert Drehmel 2002-10-20 22:50:13 +00:00
parent 47a6e68f2c
commit 47e40520dd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=105584

View file

@ -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));