This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Additional builtin memset optimization


On Sun, Apr 21, 2002 at 04:39:25PM -0600, Roger Sayle wrote:
> 
> The patch improves the code generated by built-in memset, when
> the length is a compile time constant, but the value isn't.
> Depending upon the alignment of the buffer, the compiler will
> perform a sequence of byte stores of the value c, short stores
> of c * 0x0101, or word stores of c * 0x0101, where c is the
> run-time value argument cast to an unsigned char.

Is there any reason to limit this to 32-bit words?  It seems likely to
me that the alpha could benefit from doing 64-bit stores when
alignment cooperates, frex

> extern int buffer[4];
> void bar(int c) { memset(buffer,c,16); }

if that was extern long buffer[2], we could do another sll/addq pair
and just two store operations.

Also, I note that the glibc sysdeps/alpha/memset.S uses stq_u
operations -- dunno if it would be worthwhile to do that here.

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]