Thu, 2 Apr 1992 04:31:53 GMT

Related articles |
---|

Is there a way of generating code for x/const without division? jeremy@sw.oz.au (1992-04-02) |

Re: Is there a way of generating code for x/const without division? suitti@ima.isc.com (1992-04-03) |

Re: Is there a way of generating code for x/const without division? moss@cs.umass.edu (1992-04-03) |

Re: Is there a way of generating code for x/const without division? markt@harlqn.co.uk (1992-04-08) |

Re: Is there a way of generating code for x/const without division? haddad@pa.dec.com (1992-04-07) |

Newsgroups: | comp.compilers,comp.programming,comp.lang.c |

From: | jeremy@sw.oz.au (Jeremy Fitzhardinge) |

Summary: | I want to avoid divide |

Keywords: | code, arithmetic, optimize |

Organization: | Softway Pty Ltd |

Date: | Thu, 2 Apr 1992 04:31:53 GMT |

I've been playing with a simple code generator for RISC CPUs. One of the

simple peephole optimisations it does is to replace multiplies by

constants with a series of shift/adds rather than using the general

multiplication.

I'm wondering whether a similar thing can be done for divide and modulo,

such that they are implemented by the code generator as a sequence of

simple instructions that is more efficient (in time) than the more general

way of performing divide/modulo.

Thanks,

Jeremy.

--

jeremy@softway.sw.oz.au ph:+61 2 698 2322-x122 fax:+61 2 699 9174

[I'd think that in most cases it should be possible to do as multiplication

if you can construct multiplies that discard one or the other half of the

product. -John]

--

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.