Predication Flashcards
What is predication?
We do the work of both the T and NT paths, and then throw away the wrong path
When should we use predication?
When the cost is smaller! If branch prediction averages 25 cycles and predication costs 10, then predication is better. Example: small if-else statements
What is If-Conversion?
the process a compiler uses to transform small if-statements to not have a branch (so that the hardware uses predication)
How do we implement if-converesion?
Conditional move:
Ex. MOVZ Rd, Rs, Rt (move Rs into Rd if Rt is equal to 0)
This is not a branch instruction!
What are the problems with conditional moves?
We need more registers and more instructions are executed
How do we solve the problems of conditional moves?
Full predication (every instruction has a condition for it to be executed)
How is full predication implemented?
Usually represented in the hardware by adding conditional bits to the instruction