1 <!-- Instructions here described in PowerISA Version 3.0 B Book 1 -->
3 <!-- Section 2.4 Branch Instructions. Pages 33 - 39 -->
5 <!-- The sequence of instruction execution can be changed by the Branch -->
6 <!-- instructions. Because all instructions are on word boundaries, bits 62 and 63 -->
7 <!-- of the generated branch target address are ignored by the processor in -->
8 <!-- performing the branch. -->
10 <!-- target_addr specifies the branch target address. -->
12 <!-- If AA=0 then the branch target address is the sum of LI || 0b00 sign-extended -->
13 <!-- and the address of this instruction, with the high-order 32 bits of the branch -->
14 <!-- target address set to 0 in 32-bit mode. -->
16 <!-- If AA=1 then the branch target address is the value LI || 0b00 sign-extended, -->
17 <!-- with the high-order 32 bits of the branch target address set to 0 in 32-bit -->
20 <!-- If LK=1 then the effective address of the instruction following the Branch -->
21 <!-- instruction is placed into the Link Register. -->
27 * b target_addr (AA=0 LK=0)
28 * ba target_addr (AA=1 LK=0)
29 * bl target_addr (AA=0 LK=1)
30 * bla target_addr (AA=1 LK=1)
34 if AA then NIA <-iea EXTS(LI || 0b00)
35 else NIA <-iea CIA + EXTS(LI || 0b00)
36 if LK then LR <-iea CIA + 4
38 Special Registers Altered:
46 * bc BO,BI,target_addr (AA=0 LK=0)
47 * bca BO,BI,target_addr (AA=1 LK=0)
48 * bcl BO,BI,target_addr (AA=0 LK=1)
49 * bcla BO,BI,target_addr (AA=1 LK=1)
53 if (mode_is_64bit) then M <- 0
55 if ¬BO[2] then CTR <- CTR - 1
56 ctr_ok <- BO[2] | ((CTR[M:63] != 0) ^ BO[3])
57 cond_ok <- BO[0] | ¬(CR[BI+32] ^ BO[1])
58 if ctr_ok & cond_ok then
59 if AA then NIA <-iea EXTS(BD || 0b00)
60 else NIA <-iea CIA + EXTS(BD || 0b00)
61 if LK then LR <-iea CIA + 4
63 Special Registers Altered:
68 # Branch Conditional to Link Register
72 * bclr BO,BI,BH (LK=0)
73 * bclrl BO,BI,BH (LK=1)
77 if (mode_is_64bit) then M <- 0
79 if ¬BO[2] then CTR <- CTR - 1
80 ctr_ok <- BO[2] | ((CTR[M:63] != 0) ^ BO[3])
81 cond_ok <- BO[0] | ¬(CR[BI+32] ^ BO[1])
82 if ctr_ok & cond_ok then NIA <-iea LR[0:61] || 0b00
83 if LK then LR <-iea CIA + 4
85 Special Registers Altered:
90 # Branch Conditional to Count Register
94 * bcctr BO,BI,BH (LK=0)
95 * bcctrl BO,BI,BH (LK=1)
99 cond_ok <- BO[0] | ¬(CR[BI+32] ^ BO[1])
100 if cond_ok then NIA <-iea CTR[0:61] || 0b00
101 if LK then LR <-iea CIA + 4
103 Special Registers Altered:
107 # Branch Conditional to Branch Target Address Register
111 * bctar BO,BI,BH (LK=0)
112 * bctarl BO,BI,BH (LK=1)
116 if (mode_is_64bit) then M <- 0
118 if ¬BO[2] then CTR <- CTR - 1
119 ctr_ok <- BO[2] | ((CTR[M:63] != 0) ^ BO[3])
120 cond_ok <- BO[0] | ¬(CR[BI+32] ^ BO[1])
121 if ctr_ok & cond_ok then NIA <-iea TAR[0:61] || 0b00
122 if LK then LR <-iea CIA + 4
124 Special Registers Altered:
130 <!-- Checked March 2021 -->