# Re: Multiplication by a constant - how?

## preston@cs.rice.edu (Preston Briggs)2 Apr 1997 15:58:11 -0500

From comp.compilers

Related articles
[4 earlier articles]
Re: Multiplication by a constant - how? harwood@trinidad.progress.com (1997-03-16)
Re: Multiplication by a constant - how? dlmoore@ix.netcom.com (David L Moore) (1997-03-16)
Re: Multiplication by a constant - how? preston@tera.com (1997-03-21)
Re: Multiplication by a constant - how? torbenm@diku.dk (1997-03-21)
Re: Multiplication by a constant - how? Sergey.Solyanik@bentley.com (Sergey Solyanik) (1997-03-27)
Re: Multiplication by a constant - how? cdg@nullstone.com (Christopher Glaeser) (1997-03-31)
Re: Multiplication by a constant - how? preston@cs.rice.edu (1997-04-02)
| List of all articles for this month |

 From: preston@cs.rice.edu (Preston Briggs) Newsgroups: comp.compilers Date: 2 Apr 1997 15:58:11 -0500 Organization: Rice University References: 97-03-062 97-03-092 97-03-114 97-03-150 Keywords: arithmetic, optimize

>> Bernstein's techniques won't always find optimal code. One way around
>> the "problem" is to write a little program that exhaustively computes
>> optimal sequences and let it crunch for a long time.
>
>I've done it with memoizing algorithm that tries and builds a tree of
>numbers/decompositions. It produces EXACTLY the same sequence as
>Visual C compiler. When I ran it for all 32K numbers, the longest
>sequence was 11 operations. By the way, with memoization it really
>runs very fast - factoring all 32K numbers took well under half a
>minute.

But is Visual C producing optimal code? As for "a long time" versus
"under half a minute", recall that there are more than 32K numbers!

Preston Briggs

--

Post a followup to this message