Index

# Lecture 11

## 6. Deferred Exceptions

• If an instruction is hosted above a conditional branch and it cause an exception, it should only be handled if the branch is not taken

e.g.

``````BEQZ    R4, L1
LW      R1, (R5)
• solution: add a "poison" bit to register and if a speculated instruction faults, set the poison bit.
``````LW.S    R1, (R5)    ;set poison bit if it faults
BEQZ    R4, L1
LW.C    R1, (R5)    ;handle excption if poison bit is set

IA-64

``````ld8.s   r1=[r5];;   ;set poison bit
br      L1
chk.s   r1, repair  ;branch to repair if poison
b       l2``````

## 7. Predicated Execution

• insturctions only commit thier result (e.g. write register or mem) if the condition (predicate) is true

e.g.

``````if (A && B)     //R1 R2
j = j + 1;  //R4
else if (C)     //R3
k = k + 1;  //R5
else
k = k - 1;  //R6
i =i + 1;``````
``````BEQ     R1, R0, L1
NOP
BEQ     R2, R0, L1
NOP
J       L3
NOP
L1 BEQ  R3, R0, L2
J       L3
NOP
L2 SUBI R5, R5, 1

ARM

``````CMP     R1, #0          set condition flat(N, Z, C, V)
CMPNE   R2, #0          conditionally executed if Z flag is not set
JNE     L1
CMP     R3, #0
SUBEQ   R5, R5, #1

8 instructions - longest path = 8

IA-64

``````    cmp.eq      p1, p2=r0, c1;;     p1=(r1==0), p2=!(r1==0)
(p2)cmp.eq      p1, p3=r0, r2       if p2 {p1=(r2==0), p3=!(r2==0)}
(p1)cmp.ne.unc  p4,p5=0,r3          p4=p1&&(r3!=0), p5=p1&&!(r3!=0) unc clears both predicate register if predicate is false
(p5)sub         r5=r5,1

7 instruction - longest path = 7

• executes all paths but only commits one
• turns control dependencies into data dependencies (which can be satified later in the pipeline => less stalls/ naps)
• useful when blocks are small

## 8 IA-64

• joint venture of Intel & HP
• EPIC architecture
• Explicity Parallel Instruction Computing
• similar to VLIW but with dependency and support for dynamic events such as cache misses
• register set:
• 128 65-bit integer registers
• 128 82-bit f.p. registers
• 64 1-bit predicate registers
• 8 64-bit branch registers
• all instructions are predicated
• instructions are fetched in 128-bit bundles

Index