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