1 <!-- Draft Instructions here described in -->
2 <!-- https://libre-soc.org/openpower/sv/bitmanip/ -->
3 <!-- These instructions are *not yet official* -->
20 Special Registers Altered:
24 # Ternary Bitwise Logic Immediate
28 * ternlogi RT,RA,RB,TLI (Rc=0)
29 * ternlogi. RT,RA,RB,TLI (Rc=1)
35 idx <- (RT)[i] || (RA)[i] || (RB)[i]
39 Special Registers Altered:
43 # GPR Dynamic Binary Logic
47 * binlog RT,RA,RB,RC,nh
51 if nh = 1 then lut <- (RC)[56:59]
52 else lut <- (RC)[60:63]
55 idx <- (RA)[i] || (RB)[i]
61 If nh contains a 0, let lut be the four LSBs of RC
62 (bits 60 to 63). Otherwise let lut be the next
63 four LSBs of RC (bits 56 to 59).
65 Let j be the value of the concatenation of the
66 contents of bit i of RT with bit i of RB.
68 The value of bit j of lut is placed into bit i of RT.
70 Special registers altered:
74 # Condition Register Ternary Bitwise Logic Immediate
78 * crfternlogi BF,BFA,BFB,TLI,msk
82 bf <- CR[4*BF+32:4*BF+35]
83 bfa <- CR[4*BFA+32:4*BFA+35]
84 bfb <- CR[4*BFB+32:4*BFB+35]
88 idx <- bf[i] || bfa[i] || bfb[i]
92 CR[4*BF+32+i] <- result[i]
94 Special Registers Altered:
98 # Condition Register Field Ternary Bitwise Logic Immediate
102 * crternlogi BT,BA,BB,TLI
106 idx <- CR[BT+32] || CR[BA+32] || CR[BB+32]
107 CR[BT+32] <- TLI[idx]
109 Special Registers Altered:
113 # Condition Register Field Dynamic Binary Logic
117 * crfbinlog BF,BFA,BFB,msk
121 a <- CR[4*BF+32:4*BFA+35]
122 b <- CR[4*BFA+32:4*BFA+35]
123 lut <- CR[4*BFB+32:4*BFB+35]
128 result[i] <- lut[idx]
131 CR[4*BF+32+i] <- result[i]
135 For each integer value i, 0 to 3, do the following.
137 Let j be the value of the concatenation of the
138 contents of bit i of CR Field BF with bit i of CR Field BFA.
140 If bit i of msk is set to 1 then the value of bit j of
141 CR Field BFB is placed into bit i of CR Field BF.
143 Otherwise, if bit i of msk is a zero then bit i of
144 CR Field BF is unchanged.
146 If `msk` is zero an Illegal Instruction trap is raised.
148 Special registers altered:
152 # Condition Register Dynamic Binary Logic
160 lut <- CR[4*BFB+32:4*BFB+35]
161 idx <- CR[BT+32] || CR[BA+32]
162 CR[BT+32] <- lut[idx]
164 Special registers altered:
168 # Add With Shift By Immediate
172 * sadd RT,RA,RB,SH (Rc=0)
173 * sadd. RT,RA,RB,SH (Rc=1)
178 m <- ((0b0 || SH) + 1)
179 RT <- (n[m:XLEN-1] || [0]*m) + (RA)
181 Special Registers Altered:
185 # Add With Shift By Immediate Word
189 * saddw RT,RA,RB,SH (Rc=0)
190 * saddw. RT,RA,RB,SH (Rc=1)
194 n <- ([0]*(XLEN/2)) || (RB)[XLEN/2:XLEN-1]
195 if (RB)[XLEN/2] = 1 then
196 n[0:XLEN/2-1] <- [1]*(XLEN/2)
197 m <- ((0b0 || SH) + 1)
198 RT <- (n[m:XLEN-1] || [0]*m) + (RA)
200 Special Registers Altered:
204 # Add With Shift By Immediate Unsigned Word
208 * sadduw RT,RA,RB,SH (Rc=0)
209 * sadduw. RT,RA,RB,SH (Rc=1)
213 n <- ([0]*(XLEN/2)) || (RB)[XLEN/2:XLEN-1]
214 m <- ((0b0 || SH) + 1)
215 RT <- (n[m:XLEN-1] || [0]*m) + (RA)
217 Special Registers Altered: