Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!rpi!masscomp!sharp!joeo From: joeo@sharp..westford.ccur.com (Joe Orost) Newsgroups: comp.arch,ccc.eng Subject: Re: bizarre instructions Message-ID: <61756@masscomp.westford.ccur.com> Date: 26 Feb 91 12:17:22 GMT References: <9102220245.AA14853@ucbvax.Berkeley.EDU> <1991Feb25.134714.23523@linus.mitre.org> <10244@dog.ee.lbl.gov> <1991Feb25.203629.5059@linus.mitre.org> <10278@dog.ee.lbl.gov> Sender: news@masscomp.westford.ccur.com Reply-To: joeo@tinton.ccur.com (Joe Orost) Followup-To: comp.arch Organization: Concurrent Computer Corporation, Tinton Falls, NJ Lines: 48 In article <10278@dog.ee.lbl.gov> torek@elf.ee.lbl.gov (Chris Torek) writes: > >I have only a vague idea what `could not be done in the HLL' means. >Did I use a construct that is not provided by the compiler? Or is >`assembler routines had to be called' the key phrase? Do you mean >`machine dependent instructions had to be emitted'? Of course this is >the case. Do you mean `the rules for emitting the machine dependent >instructions were not built into the compiler'? This depends on what >one means by `built in'. Is the following sin() routine `built in' >to the compiler?: > > static __inline const double sin(double x) { > double result; > __asm("sin %1,%0" : "=f"(result) : "f"(x)); > return result; > } > >I claim that if this appears in , it *is* built-in to the >compiler, despite the fact that the compiler reads these rules from an >external file rather than having them embedded directly in its >executable. Not so fast. Our C3Ada-68K compiler and our Fortran VII-3200 compiler has the transcendentals built-in. This means much more than just compiling the calls inline. Built-in means that: 1. Constant evaluation is performed at compile time: SIN(0.0) is replaced by 0.0, etc. 2. Common subexpressions and loop invarient code motion is performed on these operations at compile time: SIN(A) ... SIN(A) replaced by one call using a tempo. 3. Special-case optimizations are performed: A**0.5 -> SQRT(A) A**1.0 -> A 4. The compiler knows the argument profile for the routines. In Fortran, SQRT(2) gets a warning and is converted to SQRT(2.0). 4. The calls generate inline code. regards, joe -- Full-Name: Joseph M. Orost Email: joeo@tinton.ccur.com Phone: (908) 758-7284 Fax: (908) 758-7113 US Mail: MS 322; Concurrent Computer Corporation; 106 Apple St Tinton Falls, NJ 07724 Brought to you by Super Global Mega Corp .com