Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Mar 2003 22:37:03 +0000
From:      Mark Murray <mark@grondar.org>
To:        Peter Jeremy <peterjeremy@optushome.com.au>
Cc:        chat@FreeBSD.ORG
Subject:   Re: cvs commit: src/lib/libc/i386/string Makefile.inc wcscmp.S 
Message-ID:  <200303102237.h2AMb3Ig074356@grimreaper.grondar.org>
In-Reply-To: Your message of "Tue, 11 Mar 2003 04:57:39 %2B1100." <20030310175739.GA4311@cirb503493.alcatel.com.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
Peter Jeremy writes:
> [Please copy me on any followups]
> 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.

Yeah, but that is not general purpose. If someone didn't know of the
wcscmp() function and coincidentally coded an exact replica under a
different name, this would fail. What I'm asking of the compiler gurus
is "How far can optimization be practically taken, in theory?" (Does
that make sense?!)

> 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 guessing that this means there will always be room for humans to
hand-code assembler. How far can this be made redundant, given that
there is still lots of effort going into hand-coded asm functions?

> >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.

I would object to that too, in much the same way as I object to the
GCC optimization of turning (eg) strlen() into an intrinsic operation.

> >iumop ap!sdn w,I idlaH
> Nice.

iwalqojd oN

M
--
Mark Murray
iumop ap!sdn w,I idlaH

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?200303102237.h2AMb3Ig074356>