# Re: Selective Computation...

## Joachim Durchholz <joachim_d@gmx.de>31 Dec 2002 23:46:39 -0500

From comp.compilers

Related articles
Selective Computation... saru@jeyan.eclipse.co.uk (Saru) (2002-12-26)
Re: Selective Computation... jeyan@jeyan.eclipse.co.uk (Saru) (2002-12-30)
Re: Selective Computation... saru@jeyan.eclipse.co.uk (Saru) (2002-12-30)
Re: Selective Computation... joachim_d@gmx.de (Joachim Durchholz) (2002-12-31)
Re: Selective Computation... thp@cs.ucr.edu (2003-01-17)
Re: Selective Computation... Patrick.Volteau@st.com (Patrick Volteau) (2003-01-20)
Re: Selective Computation... strohm@airmail.net (John R. Strohm) (2003-01-21)
Re: Selective Computation... andreas.gieriet@externsoft.ch (Andreas Gieriet) (2003-01-21)
Re: Selective Computation... liekweg@freenet.de (Florian Liekweg) (2003-01-21)
Re: Selective Computation... marcov@toad.stack.nl (Marco van de Voort) (2003-02-06)
| List of all articles for this month |

 From: Joachim Durchholz Newsgroups: comp.compilers Date: 31 Dec 2002 23:46:39 -0500 Organization: Compilers Central References: 02-12-116 Keywords: optimize Posted-Date: 31 Dec 2002 23:46:39 EST

Saru wrote:
> I have a computation which evaluates X as
>
> X=k1*(p+q)+k2*(p+q')+k3*(p'+q);
>
> [with k1, k2, k3 in {0,1}]

For me, this translates to

X := 0
if k1 = 1 then
X := X + (p + q)
end
if k2 = 1 then
X := X + (q + q')
end
if k3 = 1 then
X := X + (p' + q)
end

It doesn't look very "elegant", but doing things in the most
straightforward manner makes it easiest for the optimizer to figure out
what's going on and choose the appropriate optimizations (including
optimizations that we don't think of right now).

Or do I miss something here?

Regards,
Joachim

Post a followup to this message