Given expression is : XY + XYZ + YZ now rewrite it as X( Y+ YZ) +YZ;
Take required general purpose registers R0, R1, R2, R3;
from the expression X*( Y+ Y*Z) +Y*Z
1) MUL Y, Z, R0; multiply y and z and store in R0 ; op(Y*Z)
2) ADD Y, R0, R1 store in R1 : op( Y+YZ)
3) MUL X, R1, R2 multiply X*(Y+Y*Z) and store in R2;
now add R2 with R0 and store in R3 ;
4) ADD R2, R0, R3;
Operation 1) and 3) take 2 clock cycles each and operation 2) and 4) take 1 each
Total 2+1+2+1= 6