[CST-2] Comparative Architectures

Jonny Graham jlg33@cam.ac.uk
Thu, 30 May 2002 22:16:45 +0100


I think I understand what he's saying. Pred. Ex is straight forward:
e.g
if (x==0) x=y+z;
becomes (in made-up pseudo-code, C at end means 'conditional')
CMP X,#0  ; if x==0, set conditional flag
ADDC x <- y,z ; if cond flag set, x=y+z, else NOP (ie. annull)
...

using CMOV we would have something like
CMP X,#0
ADD t <- y,z; *always* do this: temporary reg t=x+y
CMOV x <- t; if conditional flag is set, copy t to x (ie. commit)
...

They both have the same effect; I think what he says about side-effects 
is why I need to use a temporary reg.

HTH,
Jonny

John Wyllie wrote:
> This is what the Ian Pratt told me:
> 
> 
>>'predicated execution' and 'conditional moves' are both
>>techniques for 'straightening if-then-else code'.
>>
>>Pred. Ex. enables instructions on the 'wrong' path to be
>>annulled.
>>
>>With cond. move., they get executed (so you have to be careful
>>about side effects), but you can use the cond move to 'commit'
>>one of the paths by selecting a result.
> 
> 
> It doesn't make it any clearer to me.
> Can anyone else explain it a bit better?
> 
> John
> 
> 
> 
> 
> 
> 
> 
>>-----Original Message-----
>>From: cst-2-admin@srcf.ucam.org [mailto:cst-2-admin@srcf.ucam.org]On
>>Behalf Of Alvin
>>Sent: 30 May 2002 20:59
>>To: cst-2@srcf.ucam.org
>>Subject: Re: [CST-2] Comparative Architectures
>>
>>
>>Not quite sure that's correct...  Surely all instruction's
>>execution depend
>>on the bits stored with the instruction, and I don't think you can change
>>the bits of an instruction depending on certain conditions.
>>
>>Anyway, predicated instructions and conditional instructions both refer to
>>the same chapter in Computer Architecture: A quantitative approach.  I'm
>>happy to take that as the final word.
>>
>>Alvin
>>
>>
>>>Predicated execution depends on a set of bits stored with the
>>>instruction, whereas conditional moves depend on flags or a nominated
>>>register.
>>>
>>>=========================
>>>Stephen McIntosh.
>>>
>>>www.stephenmcintosh.com
>>
>>
>>
>>_______________________________________________
>>CST-2 mailing list
>>CST-2@srcf.ucam.org
>>http://www.srcf.ucam.org/mailman/listinfo/cst-2
>>
> 
> 
> 
> 
> _______________________________________________
> CST-2 mailing list
> CST-2@srcf.ucam.org
> http://www.srcf.ucam.org/mailman/listinfo/cst-2


-- 
Jonny Graham
01223 565 373

Selwyn College
Grange Road
Cambridge
CB3 9DQ