Newsgroups: comp.compilers Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!world!iecc!compilers-sender From: daryl@hpclopt.cup.hp.com Subject: Optimizing IEEE Floating-Point Operations Message-ID: <91-06-005@comp.compilers> Keywords: arithmetic, design, Fortran, C Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: daryl@hpclopt.cup.hp.com Organization: Hewlett-Packard, California Language Lab Date: Thu, 06 Jun 91 13:35:22 PDT Approved: compilers@iecc.cambridge.ma.us Suppose I have a program with the following statements: x = 0.0; /* statement A */ y = y * x; /* statement B */ Let us assume that x and y are floating-point variables and that the underlying machine uses the IEEE floating-point representation. Assuming that we can determine that x does not change between A and B, should the expression (y * x) in statement B be replaced with 0.0? What if y is a NaN? (A constant propagation pattern like this occurs in the tomcatv SPEC benchmark.) The PA-RISC compilers do not currently perform this transformation because it makes conservative assumptions about the programmer's desire to adhere to the IEEE standard. What do compilers from other vendors (besides HP) do by default? Are any options provided to override the default? Does anyone have an opinion on what the right thing to do is? Thanks, Daryl Odnert daryl@hpclopt.cup.hp.com Hewlett-Packard California Language Lab [There currently is a heated argument in comp.arch on this point, with much of the problem being that the IEEE FP standard and the various language standards talk past each other, leaving large grey areas. -John] -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.