Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!cs.uoregon.edu!ogicse!milton!uw-beaver!rice!ariel.rice.edu!preston From: preston@ariel.rice.edu (Preston Briggs) Newsgroups: comp.arch Subject: Re: Compilers and efficiency Message-ID: <1991Apr28.154603.8003@rice.edu> Date: 28 Apr 91 15:46:03 GMT References: <9782@mentor.cc.purdue.edu> <4082@batman.moravian.EDU> <11411@mentor.cc.purdue.edu> Sender: news@rice.edu (News) Organization: Rice University, Houston Lines: 28 hrubin@pop.stat.purdue.edu (Herman Rubin) writes: > If the languages do not allow the user to communicate the use of those > features of the CISC architecture which can make the object code considerably > faster, the compiler cannot take advantage of them. This IS the situation. > For example, suppose there was an instruction, which could be effectively > used, which would divide a float by a float, obtaining an integer quotient > and a float remainder. Now just how is the compiler to recognize that this > is in fact wanted? In Fortran, you might write iq = f1 / f2 and a while later (during which f1 and f2 are not changed) fr = amod(f1, f2) The compiler could recognize, during value numbering, that an quotient and remainder of the same operands was being computed. During instruction selection (or perhaps peephole optimization), it could recognize that it could avoid the real2int conversion of the quotent by using the "hrubin" instruction. Not everyone does these things the way I've described them, but many compilers can achieve the same effect, one way or another. Preston Briggs