Post on 22-Sep-2020
19
20
Floating point representation of real numbers
21
22
23
24
25
ten two
Floating point representation of real numbers
26
27
28
ten two-4
29
Why is number with smaller exponent shifted to right for alignment?
-1
-2
30
31
32
33
34
35
36
37
38
39
40
41
42
MM: li $t1, 32li $so, 0
L1: li $s1, 0L2: li $s2, 0
sll $t2, $s0, 5addu $t2, $t2, $s1sll $t2, $t2, 3addu $t2, $a0, $t2l.d. $f4, 0($t2)
L3: sll $t0, $s0, 5addu $t0, $t0, $s1sll $t0, $t0, 3addu $t0, $a2, $t0l.d. $f16, 0($t0)
sll $t2, $s0, 5addu $t0, $t0, $s2sll $t0, $t0, 3addu $t0, $a1, $t0l.d. $f18, 0($t0)
mul.d $f16, $f18, $f16add.d $f4, $f4, $f16
addiu $s2, $s2, 1bne $s2, $t1, L3s.d. $f4, 0($t2)
addiu $s1, $s1, 1bne $s1, $t1, L2addiu $s0, $s0, 1bne $s0, $t1, L1………......
X=X+Y*Z X is a 32x32 matrix. Same for Y and Z.$s0 i $s1 j $s2 k$a0 X $a1 Y $a2 ZEach matrix element has 8 bytes (floating point double precision)Each row of X is stored in memory as consecutive 32*8 bytes.The 32 rows are stored as consecutive 32*32*8 bytes.Same for Y and Z
Example of a 4x4 matrix
X00 X01 X02 X03X10 X11 X12 X13X20 X21 X22 X23X30 X31 X32 X33
Xij=[Yi0 Yi1 Yi2 Yi3]x Zj0 Zj1 Zj2 Zj3
sll instruction can be used for multiplies by a power of 2
3 loops:L1 is i loop.L2 is j loopL3 is k loop
43
44
45
46
47
nd
48