Date: Tue, 11 Mar 2003 04:57:39 +1100 From: Peter Jeremy <peterjeremy@optushome.com.au> To: chat@FreeBSD.ORG Cc: "Tim J. Robbins" <tjr@FreeBSD.ORG>, Mark Murray <mark@grondar.org> Subject: Re: cvs commit: src/lib/libc/i386/string Makefile.inc wcscmp.S Message-ID: <20030310175739.GA4311@cirb503493.alcatel.com.au> In-Reply-To: <200303101238.h2ACcaIg077406@grimreaper.grondar.org> References: <200303101054.h2AAsaKu089414@repoman.freebsd.org> <200303101238.h2ACcaIg077406@grimreaper.grondar.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[Please copy me on any followups] On Mon, Mar 10, 2003 at 12:38:36PM +0000, Mark Murray wrote: >"Tim J. Robbins" writes: >> MFp4: Pentium-optimised implementation of wcscmp(). Performs significantly >> better than the code generated by gcc in many cases. > >is this the sort of thing that a compiler _in_theory_ could/should do >well, or is this the kind of assembler code that only a human could be >expected to come up with? In theory, there's no reason why a computer application can't do anything a human could do. In practice this is a lot more difficult. It would be fairly simple to get a compiler to do boilerplate code substitution: if (cpu==Pentium && function=="wcscmp") emit code. This just moves the code for wcsmp.S into the gcc back-end - where it is still MD but now in a format that fewer people can understand and still fewer would feel comfortable in modifying. In general, the best optimisations are achieved at a much higher level than compilers can easily achieve. My favourite example of this is the original code for compress(1) - which turns about 1/2 page of C code into a single VAX instruction. You're not going to get a compiler to recognize this level of equivalence. >I'm not too charmed with MD code; the more that could be done by the >compiler, the more I like it. :-) I think you still wind up with just as much MD code, it's just hidden in the compiler. >iumop ap!sdn w,I idlaH Nice. Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030310175739.GA4311>