Translate the following into IA64 code, making use of predication.


for (i = 0; i < 100: i++)
{ if (X[i] = Y[i])
Y[i] = Y[i] + 1;
else X[i] = X[i] – 1;
}



mov ar.lc = 100 //set up loop count in lc register
ld4 r2 = [r10],4 ;; //get x[i] in r2
ld4 r3 = [r11],4 ;; //get y[i] in r3
cmp.eq p1,p2 = r2,r3 ;; //compare x[i] and y[i]
(p1) add r3 = r3,1 //if part
(p2) sub r2 = r2,1 ;; //else part
(p1) st4 [r11] = r3,4 //copy to destination (if)
(p2) [r10] = r2,4 //copy to destination (else)
br.cloop next ;; //decrement lc register and branch

Note that we can do the if and else parts in parallel by using the true/false predication. Note also that there
is little room for parallel operation exception the two if/else parts which are mutually exclusive.

Computer Science & Information Technology

You might also like to view...

Two numbers are relatively prime if their greatest common divisor is ______.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Another name for an associative entity is:

A) an attributive entity. B) an external entity. C) a co-variant entity. D) a gerund.

Computer Science & Information Technology

What is a selective acknowledgement and how does it affect transmissions?

What will be an ideal response?

Computer Science & Information Technology

Open source software refers to software that is free of charge

Indicate whether the statement is true or false

Computer Science & Information Technology