1 # A.3 FLoating-Point Convert from Integer Model
3 The following describes algorithmically the operation of the Floating
4 Convert From Integer instructions.
6 <!-- Power ISA Book I Version 3.0B Section A.3 page 782 -->
8 def INT2FP(FR, cvt, RN):
9 if cvt = "sint2double" then
10 tgt_precision = "double-precision"
12 if cvt = "sint2single" then
13 tgt_precision <- "single-precision"
15 if cvt = "uint2double" then
16 tgt_precision <- "double-precision"
18 if cvt = "uint2single" then
19 tgt_precision <- "single-precision"
26 if frac[0:63] = 0 then
30 FPSCR[FPRF] <- "+ zero"
32 if sign = 1 then frac[0:63] <- ¬frac[0:63] + 1
33 # do the loop 0 times if FR = max negative 64-bit integer or
34 # if FR = max unsigned 64-bit integer
36 frac[0:63] <- frac[1:63] || 0b0
38 Round_Float( tgt_precision, sign, exp, frac0:63, RN )
39 if sign = 0 then FPSCR[FPRF] <- "+normal number"
40 if sign = 1 then FPSCR[FPRF] <- "-normal number"
42 result[1:11] <- exp + 1023 # exp + bias
43 result[12:63] <- frac[1:52]