Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1080

Re: Implementation dependent behaviour (WAS: Re: Programming language and IDE design)

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.compilers
Subject Re: Implementation dependent behaviour (WAS: Re: Programming language and IDE design)
Date 2014-01-14 14:16 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <14-01-013@comp.compilers> (permalink)
References <13-11-025@comp.compilers> <14-01-007@comp.compilers> <14-01-008@comp.compilers> <14-01-011@comp.compilers>

Show all headers | View raw


glen herrmannsfeldt <gah@ugcs.caltech.edu> writes:
>It has been hardware tradition for a long time to offer double width
>product on multiply and dividend on divide, but rare for high-level
>languages to allow for its use.
>
>I believe that gcc recognizes casts to (long long) on the operands of
>multiply to generate a single multiply instruction with a double
>length product. (That is, it doesn't do the three multiplies by zero
>that the casts imply.) I don't know about divide.

Yes, gcc does that for multiplication (suitably written in C, posted
elsewhere in this thread).  It cannot do this for divide, because
there is no way to express the operation in C (boundary conditions
like overflow don't match).

>I have at times needed to multiply two 32 bit values, for a 64 bit
>product, then divide by another 32 bit value. I sometimes hope that
>the compiler figures it out.

No, it won't.  Better use a language that can express this.  Forth has
*/, which does exactly this sequence of operations; it also has
double-by-single division words, as well as
single-by-single-giving-double multiplication words.

- anton
--
M. Anton Ertl
anton@mips.complang.tuwien.ac.at
http://www.complang.tuwien.ac.at/anton/

Back to comp.compilers | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Implementation dependent behaviour (WAS: Re: Programming language and IDE design) Martin Ward <martin@gkc.org.uk> - 2013-11-20 10:29 +0000
  Re: Implementation dependent behaviour (WAS: Re: Programming language and IDE design) Joshua Cranmer 🐧 <Pidgeot18@verizon.net> - 2013-11-23 01:06 -0600
    Re: Implementation dependent behaviour (WAS: Re: Programming language and IDE design) glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-11-24 21:51 +0000
    Re: Implementation dependent behaviour (WAS: Re: Programming language and IDE design) Martin Ward <martin@gkc.org.uk> - 2014-01-06 19:23 +0000
  Re: Implementation dependent behaviour (WAS: Re: Programming language and IDE design) Kaz Kylheku <kaz@kylheku.com> - 2013-12-17 23:07 +0000
    Re: Implementation dependent behaviour (WAS: Re: Programming language and IDE design) Martin Ward <martin@gkc.org.uk> - 2014-01-06 19:32 +0000
  Re: Implementation dependent behaviour (WAS: Re: Programming language and IDE design) Ivan Godard <ivan@ootbcomp.com> - 2014-01-08 09:02 -0800
    Re: Implementation dependent behaviour (WAS: Re: Programming language and IDE design) Kaz Kylheku <kaz@kylheku.com> - 2014-01-08 18:21 +0000
      Re: Implementation dependent behaviour (WAS: Re: Programming language and IDE design) Ivan Godard <ivan@ootbcomp.com> - 2014-01-10 09:11 -0800
      Re: Implementation dependent behaviour (WAS: Re: Programming language and IDE design) glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-01-10 23:08 +0000
        Re: Implementation dependent behaviour (WAS: Re: Programming language and IDE design) Ivan Godard <ivan@ootbcomp.com> - 2014-01-13 12:47 -0800
        Re: Implementation dependent behaviour (WAS: Re: Programming language and IDE design) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-01-14 14:16 +0000

csiph-web