Added english description to lbz instruction
[openpower-isa.git] / openpower / isa / fixedload.mdwn
1 <!-- This defines instructions described in PowerISA Version 3.0 B Book 1 -->
2
3 <!-- This defines instructions that load from RAM to a register -->
4
5 <!-- Note that these pages also define equivalent store instructions, -->
6 <!-- these are described in fixedstore.mdwn -->
7
8 <!-- Section 3.3.2 This defines the Fixed-Point Load Instructions pages 47 - 53 -->
9 <!-- Section 3.3.3 Fixed-Point Store Instructions pages 54 - 56 -->
10 <!-- Section 3.3.3.1 64-bit Fixed-Point Store Instructions pages 57 -->
11 <!-- Section 3.3.4 Fixed Point Load and Store Quadword Instructions pages 58 - 59 -->
12 <!-- Section 3.3.5 Fixed-Point Load and Store with Byte Reversal Instructions page 60 -->
13 <!-- Section 3.3.5.1 64-Bit Load and Store with Byte Reversal Instructions page 61 -->
14 <!-- Section 3.3.6 Fixed-Point Load and Store Multiple Instructions page 62 -->
15
16
17
18 <!-- Section 3.3.2 This defines the Fixed-Point Load Instructions pages 47 - 53 -->
19
20 <!-- The byte, halfword, word, or doubleword in storage addressed by EA is loaded -->
21 <!-- into register RT. -->
22
23 <!-- Many of the Load instructions have an “update” form, in which register RA is -->
24 <!-- updated with the effective address. For these forms, if RA!=0 and RA!=RT, the -->
25 <!-- effective address is placed into register RA and the storage element (byte, -->
26 <!-- halfword, word, or doubleword) addressed by EA is loaded into RT. -->
27
28
29 # Load Byte and Zero
30
31 D-Form
32
33 * lbz RT,D(RA)
34
35 Pseudo-code:
36
37 b <- (RA|0)
38 EA <- b + EXTS(D)
39 RT <- ([0] * (XLEN-8)) || MEM(EA, 1)
40
41 Description:
42
43 Let the effective address (EA) be the sum (RA|0)+ D.
44 The byte in storage addressed by EA is loaded into
45 RT[56:63]. RT[0:55] are set to 0.
46
47 Special Registers Altered:
48
49 None
50
51 # Load Byte and Zero Indexed
52
53 X-Form
54
55 * lbzx RT,RA,RB
56
57 Pseudo-code:
58
59 b <- (RA|0)
60 EA <- b + (RB)
61 RT <- ([0] * (XLEN-8)) || MEM(EA, 1)
62
63 Special Registers Altered:
64
65 None
66
67 # Load Byte and Zero with Update
68
69 D-Form
70
71 * lbzu RT,D(RA)
72
73 Pseudo-code:
74
75 EA <- (RA) + EXTS(D)
76 RT <- ([0] * (XLEN-8)) || MEM(EA, 1)
77 RA <- EA
78
79 Special Registers Altered:
80
81 None
82
83 # Load Byte and Zero with Update Indexed
84
85 X-Form
86
87 * lbzux RT,RA,RB
88
89 Pseudo-code:
90
91 EA <- (RA) + (RB)
92 RT <- ([0] * (XLEN-8)) || MEM(EA, 1)
93 RA <- EA
94
95 Special Registers Altered:
96
97 None
98
99 # Load Halfword and Zero
100
101 D-Form
102
103 * lhz RT,D(RA)
104
105 Pseudo-code:
106
107 b <- (RA|0)
108 EA <- b + EXTS(D)
109 RT <- ([0] * (XLEN-16)) || MEM(EA, 2)
110
111 Special Registers Altered:
112
113 None
114
115 # Load Halfword and Zero Indexed
116
117 X-Form
118
119 * lhzx RT,RA,RB
120
121 Pseudo-code:
122
123 b <- (RA|0)
124 EA <- b + (RB)
125 RT <- ([0] * (XLEN-16)) || MEM(EA, 2)
126
127 Special Registers Altered:
128
129 None
130
131 # Load Halfword and Zero with Update
132
133 D-Form
134
135 * lhzu RT,D(RA)
136
137 Pseudo-code:
138
139 EA <- (RA) + EXTS(D)
140 RT <- ([0] * (XLEN-16)) || MEM(EA, 2)
141 RA <- EA
142
143 Special Registers Altered:
144
145 None
146
147 # Load Halfword and Zero with Update Indexed
148
149 X-Form
150
151 * lhzux RT,RA,RB
152
153 Pseudo-code:
154
155 EA <- (RA) + (RB)
156 RT <- ([0] * (XLEN-16)) || MEM(EA, 2)
157 RA <- EA
158
159 Special Registers Altered:
160
161 None
162
163 # Load Halfword Algebraic
164
165 D-Form
166
167 * lha RT,D(RA)
168
169 Pseudo-code:
170
171 b <- (RA|0)
172 EA <- b + EXTS(D)
173 RT <- EXTS(MEM(EA, 2))
174
175 Special Registers Altered:
176
177 None
178
179 # Load Halfword Algebraic Indexed
180
181 X-Form
182
183 * lhax RT,RA,RB
184
185 Pseudo-code:
186
187 b <- (RA|0)
188 EA <- b + (RB)
189 RT <- EXTS(MEM(EA, 2))
190
191 Special Registers Altered:
192
193 None
194
195 # Load Halfword Algebraic with Update
196
197 D-Form
198
199 * lhau RT,D(RA)
200
201 Pseudo-code:
202
203 EA <- (RA) + EXTS(D)
204 RT <- EXTS(MEM(EA, 2))
205 RA <- EA
206
207 Special Registers Altered:
208
209 None
210
211 # Load Halfword Algebraic with Update Indexed
212
213 X-Form
214
215 * lhaux RT,RA,RB
216
217 Pseudo-code:
218
219 EA <- (RA) + (RB)
220 RT <- EXTS(MEM(EA, 2))
221 RA <- EA
222
223 Special Registers Altered:
224
225 None
226
227 # Load Word and Zero
228
229 D-Form
230
231 * lwz RT,D(RA)
232
233 Pseudo-code:
234
235 b <- (RA|0)
236 EA <- b + EXTS(D)
237 RT <- [0] * 32 || MEM(EA, 4)
238
239 Special Registers Altered:
240
241 None
242
243 # Load Word and Zero Indexed
244
245 X-Form
246
247 * lwzx RT,RA,RB
248
249 Pseudo-code:
250
251 b <- (RA|0)
252 EA <- b + (RB)
253 RT <- [0] * 32 || MEM(EA, 4)
254
255 Special Registers Altered:
256
257 None
258
259 # Load Word and Zero with Update
260
261 D-Form
262
263 * lwzu RT,D(RA)
264
265 Pseudo-code:
266
267 EA <- (RA) + EXTS(D)
268 RT <- [0]*32 || MEM(EA, 4)
269 RA <- EA
270
271 Special Registers Altered:
272
273 None
274
275 # Load Word and Zero with Update Indexed
276
277 X-Form
278
279 * lwzux RT,RA,RB
280
281 Pseudo-code:
282
283 EA <- (RA) + (RB)
284 RT <- [0] * 32 || MEM(EA, 4)
285 RA <- EA
286
287 Special Registers Altered:
288
289 None
290
291 # Load Word Algebraic
292
293 DS-Form
294
295 * lwa RT,DS(RA)
296
297 Pseudo-code:
298
299 b <- (RA|0)
300 EA <- b + EXTS(DS || 0b00)
301 RT <- EXTS(MEM(EA, 4))
302
303 Special Registers Altered:
304
305 None
306
307 # Load Word Algebraic Indexed
308
309 X-Form
310
311 * lwax RT,RA,RB
312
313 Pseudo-code:
314
315 b <- (RA|0)
316 EA <- b + (RB)
317 RT <- EXTS(MEM(EA, 4))
318
319 Special Registers Altered:
320
321 None
322
323 # Load Word Algebraic with Update Indexed
324
325 X-Form
326
327 * lwaux RT,RA,RB
328
329 Pseudo-code:
330
331 EA <- (RA) + (RB)
332 RT <- EXTS(MEM(EA, 4))
333 RA <- EA
334
335 Special Registers Altered:
336
337 None
338
339 # Load Doubleword
340
341 DS-Form
342
343 * ld RT,DS(RA)
344
345 Pseudo-code:
346
347 b <- (RA|0)
348 EA <- b + EXTS(DS || 0b00)
349 RT <- MEM(EA, 8)
350
351 Special Registers Altered:
352
353 None
354
355 # Load Doubleword Indexed
356
357 X-Form
358
359 * ldx RT,RA,RB
360
361 Pseudo-code:
362
363 b <- (RA|0)
364 EA <- b + (RB)
365 RT <- MEM(EA, 8)
366
367 Special Registers Altered:
368
369 None
370
371 # Load Doubleword with Update Indexed
372
373 DS-Form
374
375 * ldu RT,DS(RA)
376
377 Pseudo-code:
378
379 EA <- (RA) + EXTS(DS || 0b00)
380 RT <- MEM(EA, 8)
381 RA <- EA
382
383 Special Registers Altered:
384
385 None
386
387 # Load Doubleword with Update Indexed
388
389 X-Form
390
391 * ldux RT,RA,RB
392
393 Pseudo-code:
394
395 EA <- (RA) + (RB)
396 RT <- MEM(EA, 8)
397 RA <- EA
398
399 Special Registers Altered:
400
401 None
402
403 <!-- Section 3.3.3 Fixed-Point Store Instructions pages 54 - 56 -->
404
405 <!-- The contents of register RS are stored into the byte, halfword, word, or -->
406 <!-- doubleword in storage addressed by EA. -->
407
408 <!-- Many of the Store instructions have an “update” form, in which register RA is -->
409 <!-- updated with the effective address. For these forms, the following rules apply. -->
410
411 <!-- If RA!=0, the effective address is placed into register RA. -->
412
413 <!-- If RS=RA, the contents of register RS are copied to the target storage element -->
414 <!-- and then EA is placed into RA (RS). -->
415
416 <!-- Section 3.3.3.1 64-bit Fixed-Point Store Instructions pages 57 -->
417
418 <!-- Section 3.3.4 Fixed Point Load and Store Quadword Instructions pages 58 - 59 -->
419
420 <!-- For lq, the quadword in storage addressed by EA is loaded into an even-odd pair -->
421 <!-- of GPRs as follows. In Big-Endian mode, the even-numbered GPR is loaded with -->
422 <!-- the doubleword from storage addressed by EA and the odd-numbered GPR is loaded -->
423 <!-- with the doubleword addressed by EA+8. In Little-Endian mode, the even-numbered -->
424 <!-- GPR is loaded with the byte-reversed doubleword from storage addressed by EA+8 -->
425 <!-- and the odd-numbered GPR is loaded with the byte-reversed doubleword addressed -->
426 <!-- by EA. -->
427
428 # Load Quadword
429
430 DQ-Form
431
432 * lq RTp,DQ(RA)
433
434 Pseudo-code:
435
436 b <- (RA|0)
437 EA <- b + EXTS(DQ || 0b0000)
438 RTp <- MEM(EA, 16)
439
440 Special Registers Altered:
441
442 None
443
444 <!-- Section 3.3.5 Fixed-Point Load and Store with Byte Reversal Instructions page 60 -->
445
446 # Load Halfword Byte-Reverse Indexed
447
448 X-Form
449
450 * lhbrx RT,RA,RB
451
452 Pseudo-code:
453
454 b <- (RA|0)
455 EA <- b + (RB)
456 load_data <- MEM(EA, 2)
457 RT <- [0]*48 || load_data[8:15] || load_data[0:7]
458
459 Special Registers Altered:
460
461 None
462
463 # Load Word Byte-Reverse Indexed
464
465 X-Form
466
467 * lwbrx RT,RA,RB
468
469 Pseudo-code:
470
471 b <- (RA|0)
472 EA <- b + (RB)
473 load_data <- MEM(EA, 4)
474 RT <- ([0] * 32 || load_data[24:31] || load_data[16:23]
475 || load_data[8:15] || load_data[0:7])
476
477 Special Registers Altered:
478
479 None
480
481
482 <!-- Section 3.3.5.1 64-Bit Load and Store with Byte Reversal Instructions page 61 -->
483
484 # Load Doubleword Byte-Reverse Indexed
485
486 X-Form
487
488 * ldbrx RT,RA,RB
489
490 Pseudo-code:
491
492 b <- (RA|0)
493 EA <- b + (RB)
494 load_data <- MEM(EA, 8)
495 RT <- (load_data[56:63] || load_data[48:55]
496 || load_data[40:47] || load_data[32:39]
497 || load_data[24:31] || load_data[16:23]
498 || load_data[8:15] || load_data[0:7])
499
500 Special Registers Altered:
501
502 None
503
504 <!-- Section 3.3.6 Fixed-Point Load and Store Multiple Instructions page 62 -->
505
506 # Load Multiple Word
507
508 DQ-Form
509
510 * lmw RT,D(RA)
511
512 Pseudo-code:
513
514 b <- (RA|0)
515 EA <- b + EXTS(D)
516 r <- RT[0:63]
517 do while r <= 31
518 GPR(r) <- [0]*32 || MEM(EA, 4)
519 r <- r + 1
520 EA <- EA + 4
521
522 Special Registers Altered:
523
524 None
525