Re: Problems with Hardware, Languages, and Compilers

Michael Meissner <meissner@cygnus.com>
18 Mar 1997 12:55:39 -0500

          From comp.compilers

Related articles
[4 earlier articles]
Re: Problems with Hardware, Languages, and Compilers rideau@ens.fr (Francois-Rene Rideau) (1997-03-14)
Re: Problems with Hardware, Languages, and Compilers smryan@mail.com (1997-03-14)
Re: Problems with Hardware, Languages, and Compilers rideau@ens.fr (Francois-Rene Rideau) (1997-03-16)
Re: Problems with Hardware, Languages, and Compilers robison@kai.com (Arch Robison) (1997-03-16)
Re: Problems with Hardware, Languages, and Compilers rideau@ens.fr (Francois-Rene Rideau) (1997-03-18)
Re: Problems with Hardware, Languages, and Compilers smryan@mail.com (1997-03-18)
Re: Problems with Hardware, Languages, and Compilers meissner@cygnus.com (Michael Meissner) (1997-03-18)
Re: Problems with Hardware, Languages, and Compilers dlmoore@ix.netcom.com (David L Moore) (1997-03-18)
Re: Problems with Hardware, Languages, and Compilers jan@fsnif.neuroinformatik.ruhr-uni-bochum.de (Jan Vorbrueggen) (1997-03-21)
| List of all articles for this month |

From: Michael Meissner <meissner@cygnus.com>
Newsgroups: comp.compilers,comp.lang.misc,comp.arch.arithmetic
Date: 18 Mar 1997 12:55:39 -0500
Organization: Cygnus Solutions, Massachusetts USA Office
References: 97-03-037 97-03-041 97-03-057
Keywords: arithmetic, optimize

smryan@mail.com (!@?*$%) writes:


> > Factorizing x/y as x*(1/y) is not generally done inside compilers,
> > because compiler people are generally given a quotient hardware
> > operation, rather than an inverse operation. The software that cares
>
> Nope. It is generally not done because customers scream bloody murder
> if the last few bits are different, which can easily happen with this
> transformation.
>
> Personal experience.


However, it can (and is) be done when 1/y is exactly representable. For
example, consider:


double foo(double a){ return a/4; }


The current development version of the GNU C powerpc compiler generates:


.section ".rodata"
.align 3
.LC0:
.double 0d2.50000000000000000000e-1
.section ".text"
.align 2
.globl foo
.type foo,@function
foo:
addis 9,0,.LC0@ha
addi 9,9,.LC0@l
lfd 0,0(9)
fmul 1,1,0
blr


--
Michael Meissner, Cygnus Solutions (East Coast)
4th floor, 955 Massachusetts Avenue, Cambridge, MA 02139, USA
meissner@cygnus.com, 617-354-5416 (office), 617-354-7161 (fax)


--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.