TAILIEUCHUNG - Computer organization and design Design 2nd phần 4

Hãy nhãn các chi nhánh b1, b2, b3. Các quan sát chính là hành vi của các chi nhánh b3 là tương quan với các hành vi của ngành b1 và b2. Rõ ràng, nếu ngành b1 và b2 cả hai không được thực hiện (tức là, nếu điều kiện cả hai đánh giá đúng sự thật và aa và bb là cả hai giao 0), sau đó b3 sẽ được thực hiện, kể từ khi aa và bb là rõ ràng bằng. | Reducing Branch Penalties with Dynamic Hardware Prediction 267 Here is the DLX code that we would typically generate for this code fragment assuming that aa and bb are assigned to registers R1 and R2 SUBUI 3x R3 R1 2 BNEZ R3 L1 branch b1 aa 2 ADD R1 R0 R0 aa 0 L1 SUBUI 3x R3 R2 2 BNEZ R3 L2 branch b2 bb 2 ADD R2 R0 R0 bb 0 L2 SUBU lx R3 R1 R2 R3 aa-bb BEQZ R3 L3 branch b3 aa bb Let s label these branches b1 b2 and b3. The key observation is that the behavior of branch b3 is correlated with the behavior of branches b1 and b2. Clearly if branches b1 and b2 are both not taken . the if conditions both evaluate to true and aa and bb are both assigned 0 then b3 will be taken since aa and bb are clearly equal. A predictor that uses only the behavior of a single branch to predict the outcome of that branch can never capture this behavior. Branch predictors that use the behavior of other branches to make a prediction are called correlating predictors or two-level predictors. To see how such predictors work let s choose a simple hypothetical case. Consider the following simplified code fragment chosen for illustrative purposes if d 0 d 1 if d 1 Here is the typical code sequence generated for this fragment assuming that d is assigned to R1 BNEZ R1 L1 R1 R0 1 branch b1 d 0 d 0 so d 1 ADDI L1 SUBUI 3x BNEZ R3 R1 1 R3 L2 branch b2 d 1 L2 The branches corresponding to the two if statements are labeled b1 and b2. The possible execution sequences for an execution of this fragment assuming d has values 0 1 and 2 are shown in Figure . To illustrate how a correlating predictor works assume the sequence above is executed repeatedly and ignore other branches in the program including any branch needed to cause the above sequence to repeat . 268 Chapter 4 Advanced Pipelining and Instruction-Level Parallelism Initial value of d d 0 bl Value of d before b2 d l b2 0 Yes Not taken 1 Yes Not taken 1 No Taken 1 Yes Not taken 2 No Taken 2 No Taken FIGURE Possible execution .

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.